use JavaScript instead of CoffeeScript in Views, the reason #9819

This commit is contained in:
Jason Lee 2016-01-11 11:01:15 +08:00
parent 70cba8e9a8
commit a789dcaeb3
3 changed files with 24 additions and 22 deletions

View file

@ -52,5 +52,5 @@
= render 'projects/buttons/notifications'
:coffeescript
new Star()
:javascript
new Star();

View file

@ -18,10 +18,10 @@
%tbody
= spinner nil, true
:coffeescript
projectFindFile = new ProjectFindFile($(".file-finder-holder"), {
url: "#{escape_javascript(namespace_project_files_path(@project.namespace, @project, @ref, @options.merge(format: :json)))}"
treeUrl: "#{escape_javascript(namespace_project_tree_path(@project.namespace, @project, @ref))}"
:javascript
var projectFindFile = new ProjectFindFile($(".file-finder-holder"), {
url: "#{escape_javascript(namespace_project_files_path(@project.namespace, @project, @ref, @options.merge(format: :json)))}",
treeUrl: "#{escape_javascript(namespace_project_tree_path(@project.namespace, @project, @ref))}",
blobUrlTemplate: "#{escape_javascript(namespace_project_blob_path(@project.namespace, @project, @id || @commit.id))}"
})
new ShortcutsFindFile(projectFindFile)
});
new ShortcutsFindFile(projectFindFile);

View file

@ -20,27 +20,29 @@
= emoji_icon(emoji["name"], emoji["unicode"], emoji["aliases"])
- if current_user
:coffeescript
post_emoji_url = "#{award_toggle_namespace_project_notes_path(@project.namespace, @project)}"
noteable_type = "#{votable.class.name.underscore}"
noteable_id = "#{votable.id}"
aliases = #{AwardEmoji.aliases.to_json}
:javascript
var post_emoji_url = "#{award_toggle_namespace_project_notes_path(@project.namespace, @project)}";
var noteable_type = "#{votable.class.name.underscore}";
var noteable_id = "#{votable.id}";
var aliases = #{AwardEmoji.aliases.to_json};
window.awards_handler = new AwardsHandler(
post_emoji_url,
noteable_type,
noteable_id,
aliases
)
);
$(".awards").on "click", ".emoji-menu-content li", (e) ->
emoji = $(this).find(".emoji-icon").data("emoji")
awards_handler.addAward(emoji)
$(".awards").on("click", ".emoji-menu-content li", function(e) {
var emoji = $(this).find(".emoji-icon").data("emoji");
awards_handler.addAward(emoji);
});
$(".awards").on "click", ".award", (e) ->
emoji = $(this).find(".icon").data("emoji")
awards_handler.addAward(emoji)
$(".awards").on("click", ".award", function(e) {
var emoji = $(this).find(".icon").data("emoji");
awards_handler.addAward(emoji);
});
$(".award").tooltip()
$(".award").tooltip();
$(".emoji-menu-content").niceScroll({cursorwidth: "7px", autohidemode: false})
$(".emoji-menu-content").niceScroll({cursorwidth: "7px", autohidemode: false});