diff --git a/app/assets/stylesheets/common/main_layout.css.scss b/app/assets/stylesheets/common/main_layout.css.scss index fa4dce19b..51ca60411 100644 --- a/app/assets/stylesheets/common/main_layout.css.scss +++ b/app/assets/stylesheets/common/main_layout.css.scss @@ -6,7 +6,6 @@ div#search { div#page { overflow: hidden; - width: 85em; margin: 0 30px; aside#sidebar { diff --git a/app/assets/stylesheets/common/tables.css.scss b/app/assets/stylesheets/common/tables.css.scss index f8ba822e0..2bba85ab6 100644 --- a/app/assets/stylesheets/common/tables.css.scss +++ b/app/assets/stylesheets/common/tables.css.scss @@ -28,7 +28,6 @@ table.striped { font-weight: bold; text-align: left; color: #333; - padding: 8px 6px; } } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9d1209b20..5cb1aaadb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -57,6 +57,22 @@ module ApplicationHelper html.html_safe end + def dtext_field(object, name, options = {}) + options[:name] ||= "Body" + options[:input_id] ||= "#{object}_#{name}" + options[:input_name] ||= "#{object}[#{name}]" + options[:value] ||= instance_variable_get("@#{object}").try(name) + options[:preview_id] ||= "dtext-preview" + + render "dtext/form", options + end + + def dtext_preview_button(object, name, options = {}) + options[:input_id] ||= "#{object}_#{name}" + options[:preview_id] ||= "dtext-preview" + submit_tag("Preview", "data-input-id" => options[:input_id], "data-preview-id" => options[:preview_id]) + end + protected def nav_link_match(controller, url) url =~ case controller diff --git a/app/views/artists/_form.html.erb b/app/views/artists/_form.html.erb index d3ba46625..f654a87c9 100644 --- a/app/views/artists/_form.html.erb +++ b/app/views/artists/_form.html.erb @@ -5,8 +5,7 @@ <%= f.input :url_string, :label => "URLs", :as => :text, :input_html => {:size => "50x5"} %> <%= f.input :is_active %> <%= f.input :is_banned %> - - <%= render "dtext/form", :name => "Notes", :input_id => "artist_notes", :input_name => "artist[notes]", :value => @artist.notes, :preview_id => "dtext-preview" %> + <%= dtext_field "artist", "notes" %> <%= f.button :submit, "Submit" %> - <%= f.button :submit, "Preview", "data-input-id" => "artist_notes", "data-preview-id" => "dtext-preview" %> + <%= dtext_preview_button "artist", "notes" %> <% end %> \ No newline at end of file diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index 3a3ae882d..efc0a07eb 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -3,9 +3,9 @@

Edit Comment

<%= simple_form_for(@comment) do |f| %> - <%= render "dtext/form", :name => "Body", :input_id => "comment_body", :input_name => "comment[body]", :value => @comment.body, :preview_id => "dtext-preview" %> + <%= dtext_field "comment", "body" %> <%= f.button :submit, "Submit" %> - <%= f.button :submit, "Preview", "data-input-id" => "comment_body", "data-preview-id" => "dtext-preview" %> + <%= dtext_preview_button "comment", "body" %> <% end %> diff --git a/app/views/comments/partials/new/_form.html.erb b/app/views/comments/partials/new/_form.html.erb index 0970cc999..8f5b036af 100644 --- a/app/views/comments/partials/new/_form.html.erb +++ b/app/views/comments/partials/new/_form.html.erb @@ -3,7 +3,7 @@ <%= form_tag(comments_path, :class => "simple_form") do %> <%= hidden_field "comment", "post_id", :value => post.id %> - <%= render "dtext/form", :name => "Response", :input_id => "comment_response_for_#{post.id}", :input_name => "comment[body]", :value => "", :preview_id => "dtext-preview-for-#{post.id}" %> + <%= dtext_field "comment", "body", :input_id => "comment_response_for_#{post.id}", :preview_id => "dtext-preview-for-#{post.id}" %> <%= submit_tag "Post" %> - <%= submit_tag "Preview", "data-input-id" => "comment_response_for_#{post.id}", "data-preview-id" => "dtext-preview-for-#{post.id}" %> + <%= dtext_preview_button "comment", "body", :input_id => "comment_response_for_#{post.id}", :preview_id => "dtext-preview-for-#{post.id}" %> <% end %> diff --git a/app/views/dmails/_form.html.erb b/app/views/dmails/_form.html.erb index 5359f6308..7edd51cec 100644 --- a/app/views/dmails/_form.html.erb +++ b/app/views/dmails/_form.html.erb @@ -1,9 +1,7 @@ <%= simple_form_for(dmail) do |f| %> <%= f.input :to_name, :label => "To" %> <%= f.input :title %> - - <%= render "dtext/form", :name => "Body", :input_id => "dmail_body", :input_name => "dmail[body]", :value => dmail.body, :preview_id => "dtext-preview" %> - + <%= dtext_field "dmail", "body" %> <%= f.button :submit, "Send" %> - <%= f.button :submit, "Preview", "data-input-id" => "dmail_body", "data-preview-id" => "dtext-preview" %> + <%= dtext_preview_button "dmail", "body" %> <% end %> diff --git a/app/views/forum_posts/_form.html.erb b/app/views/forum_posts/_form.html.erb index e770341ea..f33d31649 100644 --- a/app/views/forum_posts/_form.html.erb +++ b/app/views/forum_posts/_form.html.erb @@ -1,23 +1,9 @@ -
- <%= error_messages_for("forum_post") %> +<%= error_messages_for("forum_post") %> - <%= simple_form_for(@forum_post) do |f| %> - <%= f.input :topic_id, :as => :hidden %> - <%= f.input :body %> +<%= simple_form_for(@forum_post) do |f| %> + <%= f.input :topic_id, :as => :hidden %> + <%= dtext_field "forum_post", "body" %> - <%= f.button :submit, "Submit" %> - <%= f.button :submit, "Preview" %> - <% end %> -
- -
-
-
- -
-

Hide

-
-
- <%= render "dtext/help" %> -
-
+ <%= f.button :submit, "Submit" %> + <%= dtext_preview_button "forum_post", "body" %> +<% end %> diff --git a/app/views/forum_topics/_form.html.erb b/app/views/forum_topics/_form.html.erb index 0c8e70781..89947393a 100644 --- a/app/views/forum_topics/_form.html.erb +++ b/app/views/forum_topics/_form.html.erb @@ -9,7 +9,7 @@ <%= hidden_field_tag "forum_topic[original_post_attributes][topic_id]", @forum_topic.id %> <% end %> - <%= render "dtext/form", :name => "Body", :input_id => "forum_post_body", :input_name => "forum_topic[original_post_attributes][body]", :value => @forum_topic.original_post.body, :preview_id => "dtext-preview" %> + <%= dtext_field "forum_post", "body", :input_name => "forum_topic[original_post_attributes][body]", :value => @forum_topic.original_post.body %> <% end %> <% if CurrentUser.is_moderator? %> @@ -18,6 +18,6 @@ <% end %> <%= f.button :submit, "Submit" %> - <%= f.button :submit, "Preview", "data-input-id" => "forum_post_body", "data-preview-id" => "dtext-preview" %> + <%= dtext_preview_button "forum_post", "body" %> <% end %> diff --git a/app/views/user_feedbacks/new.html.erb b/app/views/user_feedbacks/new.html.erb index 0ac4c79e5..e4a64d7f2 100644 --- a/app/views/user_feedbacks/new.html.erb +++ b/app/views/user_feedbacks/new.html.erb @@ -6,11 +6,11 @@ <%= simple_form_for(@user_feedback) do |f| %> - <%= f.input :user_name %> + <%= f.input :user_name, :label => "User" %> <%= f.input :category, :collection => ["positive", "neutral", "negative"], :include_blank => false %> - <%= f.input :body, :input_html => {:size => "50x5"} %> + <%= dtext_field "user_feedback", "body" %> <%= f.button :submit, "Submit" %> - <%= f.button :submit, "Preview" %> + <%= dtext_preview_button "user_feedback", "body" %> <% end %> diff --git a/app/views/wiki_pages/_form.html.erb b/app/views/wiki_pages/_form.html.erb index 7a2a57a94..1dbda96d3 100644 --- a/app/views/wiki_pages/_form.html.erb +++ b/app/views/wiki_pages/_form.html.erb @@ -4,14 +4,14 @@ <%= simple_form_for(@wiki_page) do |f| %> <%= f.input :title %> - <%= render "dtext/form", :name => "Body", :input_id => "wiki_page_body", :input_name => "wiki_page[body]", :value => @wiki_page.body, :preview_id => "dtext-preview" %> + <%= dtext_field "wiki_page", "body" %> <% if CurrentUser.is_janitor? %> <%= f.input :is_locked %> <% end %> <%= f.button :submit, "Submit" %> - <%= f.button :submit, "Preview", "data-input-id" => "wiki_page_body", "data-preview-id" => "dtext-preview" %> + <%= dtext_preview_button "wiki_page", "body" %> <% end %>