diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c07b4ea564..7e56ce6ec6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -65,6 +65,18 @@ def feature_node(title) end end + # used in views/comments/_form.html.erb + def get_large_dropzone_id(location, reply_to) + case location + when :main + '-main' + when :reply + '-reply-' + reply_to.to_s + when :responses + '-responses' + end + end + def locale_name_pairs I18n.available_locales.map do |locale| [I18n.t('language', locale: locale), locale] diff --git a/app/views/comments/_edit.html.erb b/app/views/comments/_edit.html.erb index 0a27ef0132..34c7df59ed 100644 --- a/app/views/comments/_edit.html.erb +++ b/app/views/comments/_edit.html.erb @@ -8,8 +8,8 @@ #imagebar {width:100%;} - - <%= render :partial => "editor/toolbar" %> + + <%= render :partial => "editor/toolbar", :locals => { :comment_id => comment.id.to_s, :location => :edit } %>
diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index cd8d9c3277..a07e227dfe 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -19,16 +19,24 @@ padding-top: 10px; } - - - <%= render :partial => "editor/toolbar" %> + + + + <% locals = (location == :reply) ? + { :location => location, :reply_to => reply_to } : + { :location => location } + %> + <%= render :partial => "editor/toolbar", :locals => locals %> <% if local_assigns[:reply_to].present? %> <%= hidden_field_tag :reply_to, local_assigns[:reply_to] %> <% end %> -
- + + + + <% dropzone_large_id = get_large_dropzone_id(location,local_assigns[:reply_to]) %> +
<% body = body || params[:body] # Look for comment templates @@ -45,24 +53,20 @@ <% end %>
- -

- <%= raw translation('comments._form.drag_and_drop') %> - -

+
+
+ + + - - <%= javascript_include_tag "dragdrop" %> - - - <%= javascript_include_tag "comment.js" %> - -
- - <% if local_assigns[:comment] %> - - <%= translation('comments._form.preview') %> - - <%= translation('comments._form.cancel') %> - <% else %> - <%= translation('comments._form.preview') %> - <% end %> + $('#input_label').click(function(e){ + $E.initialize({}); + }); + + + <%= javascript_include_tag "dragdrop" %> + + + <%= javascript_include_tag "comment.js" %> + +
+ + <% if local_assigns[:comment] %> + + <%= translation('comments._form.preview') %> + + <%= translation('comments._form.cancel') %> + <% else %> + <%= translation('comments._form.preview') %> + <% end %> -   -
<%= raw translation('comments._form.logged_in', :username => current_user.username) %>   -   - -
-
+   +
<%= raw translation('comments._form.logged_in', :username => current_user.username) %>   +   + +
+
- +
diff --git a/app/views/editor/_editor.html.erb b/app/views/editor/_editor.html.erb index deba18cf64..4af54bc446 100644 --- a/app/views/editor/_editor.html.erb +++ b/app/views/editor/_editor.html.erb @@ -1,4 +1,5 @@ -<%= render :partial => "editor/toolbar" %> +<%# toolbar needs location & comment_id to make unique element IDs%> +<%= render :partial => "editor/toolbar", :locals => { :location => :main } %>
diff --git a/app/views/editor/_toolbar.html.erb b/app/views/editor/_toolbar.html.erb index 069b49c5af..3b2e649f74 100644 --- a/app/views/editor/_toolbar.html.erb +++ b/app/views/editor/_toolbar.html.erb @@ -20,10 +20,21 @@ -
+ <% dropzone_small_id = '' %> + <% case location + when :main %> + <% dropzone_small_id = 'main' %> + <% when :reply %> + <% dropzone_small_id = 'reply-' + local_assigns[:reply_to].to_s %> + <% when :edit %> + <% dropzone_small_id = 'edit-' + comment_id %> + <% when :responses %> + <% dropzone_small_id = 'responses' %> + <% end %> +
-

<%= translation('layout._header.login.login_title') %> to comment. diff --git a/app/views/notes/_responses.html.erb b/app/views/notes/_responses.html.erb index 219ac3231c..a8f903506a 100644 --- a/app/views/notes/_responses.html.erb +++ b/app/views/notes/_responses.html.erb @@ -29,8 +29,16 @@