forked from thesuss/shf-project
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#164878049 Disable contextmenu on H mark image (#707)
* add some code * ft(H-mark image): disable contextmenu on the H-mark image - disable contextmenu - add a tooltip on the image [Finishes #164878049] * ft(H-markt): Change CTA buttons layout - make context message show onclick only - disable contextmenu on 'proof of membership' image - Change CTA buttons layout [#164878049] * ft(H-markt): Change CTA buttons layout - make context message show onclick only - disable contextmenu on 'proof of membership' image - Change CTA buttons layout [#164878049] * Add new line * ft(H-markt): change download buttons color - create custom-menu file - fix custom context bug - update yaml files * ft(H-markt): writes tests for the functionality - add tests - add translation * Remove white space in parameter types to make tests pass * create custom context partial * ft(h-markt): implement custom contextmenu - implement copy_to_clipboard button - write logic for contextmenu actions - update test [Finishes #164878049] * Change swedish translation and add bottom margin on image action buttons * change to
- Loading branch information
1 parent
b62f0b5
commit 3af0fd1
Showing
15 changed files
with
314 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,63 @@ | ||
$(function() { | ||
'use strict'; | ||
"use strict"; | ||
var custom_context_id; | ||
var tooltipText; | ||
|
||
$('body').on('ajax:success', '.users_pagination', function (e, data) { | ||
$('#users_list').html(data); | ||
$("body").on("ajax:success", ".users_pagination", function(e, data) { | ||
$("#users_list").html(data); | ||
$('[data-toggle="tooltip"]').tooltip(); | ||
}); | ||
|
||
$('#userStatusForm').on('ajax:success', function (e, data) { | ||
$('#userMemberStatus').html(data); | ||
$("#userStatusForm").on("ajax:success", function(e, data) { | ||
$("#userMemberStatus").html(data); | ||
$('[data-toggle="tooltip"]').tooltip(); | ||
}); | ||
|
||
$('#editUserStatusSubmit').click(function() { | ||
$('#editStatusModal').modal('hide'); | ||
$("#editUserStatusSubmit").click(function() { | ||
$("#editStatusModal").modal("hide"); | ||
}); | ||
|
||
$(".custom-context").on("contextmenu", e => { | ||
e.preventDefault(); | ||
custom_context_id = e.currentTarget.id; | ||
$(".custom-menu").toggle(100).css({ | ||
top: e.pageY + "px", | ||
left: e.pageX + "px" | ||
}); | ||
}); | ||
|
||
$(document).on("click", () => { | ||
$(".custom-menu").hide(100); | ||
}); | ||
|
||
$(".custom-menu li").click(function(e) { | ||
const data = { | ||
"company-h-brand": { | ||
download: ".download_h_mark", | ||
link: ".link_for_h_brand", | ||
show: ".preview_h_brand" | ||
} | ||
}; | ||
const action = data[custom_context_id][$(this).attr("data-action")]; | ||
$(action)[0].click(); | ||
}); | ||
|
||
$(".copy-to-clipboard").mouseover(function() { | ||
tooltipText = $(this).attr("data-original-title"); | ||
$(this).attr("data-original-title", ""); | ||
}); | ||
$(".copy-to-clipboard").mouseleave(function() { | ||
$(this).attr("data-original-title", tooltipText); | ||
}); | ||
|
||
$(".copy-to-clipboard").click(function(e) { | ||
e.preventDefault(); | ||
var $temp = $("<input>"); | ||
$("body").append($temp); | ||
$temp.val($(this).attr("href")).select(); | ||
document.execCommand("copy"); | ||
$temp.remove(); | ||
$(this).attr("data-original-title", tooltipText); | ||
$(this).tooltip("show"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.custom-menu { | ||
list-style-type: none; | ||
padding: 0 !important; | ||
display: none; | ||
z-index:1000; | ||
position: absolute; | ||
background-color:#fff; | ||
border: 1px solid #ddd; | ||
overflow: hidden; | ||
width: 150px; | ||
white-space:nowrap; | ||
font-family: sans-serif; | ||
-webkit-box-shadow: 2px 2px 7px 0 rgba(50, 50, 50, 0.5); | ||
-moz-box-shadow: 2px 2px 7px 0 rgba(50, 50, 50, 0.5); | ||
box-shadow: 2px 2px 7px 0 rgba(50, 50, 50, 0.5); | ||
} | ||
|
||
.custom-menu li { | ||
padding: 2px 10px; | ||
} | ||
|
||
.custom-menu li:hover { | ||
background-color: #013b78; | ||
color: #fff; | ||
cursor: pointer; | ||
} | ||
.custom-context { | ||
-webkit-user-select:none; | ||
-khtml-user-select:none; | ||
-moz-user-select:none; | ||
-ms-user-select:none; | ||
-o-user-select:none; | ||
user-select:none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,7 +230,7 @@ margin: 5px 0 0 0; | |
} | ||
|
||
.infotext p { | ||
margin-bottom: 1rem; | ||
margin: 0.5rem 0 0.5rem 0; | ||
} | ||
|
||
.login { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,7 @@ | |
} | ||
|
||
} | ||
|
||
#text { | ||
margin-top: 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
%ul.custom-menu | ||
%li{ "data-action" => "download" }= t('users.show.download_image') | ||
%li{ "data-action" => "link" }= t('users.show.copy_image_url') | ||
%li{ "data-action" => "show" }= t('users.show.show_image') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.