diff --git a/.sass-cache/b118d4c1b1aae4efe3003ca592302b34dd7f51b1/default.scssc b/.sass-cache/b118d4c1b1aae4efe3003ca592302b34dd7f51b1/default.scssc index 757869c64..5bb4eaff8 100644 Binary files a/.sass-cache/b118d4c1b1aae4efe3003ca592302b34dd7f51b1/default.scssc and b/.sass-cache/b118d4c1b1aae4efe3003ca592302b34dd7f51b1/default.scssc differ diff --git a/app/views/artists/_form.html.erb b/app/views/artists/_form.html.erb index 4d18a66e8..908d3f168 100644 --- a/app/views/artists/_form.html.erb +++ b/app/views/artists/_form.html.erb @@ -1,41 +1,8 @@ -<%= form_for(@artist) do |f| %> - <%= error_messages_for "artist" %> - - - - - - - - - - - - - - - - - - - - - - - - - -
<%= f.label :name %> - <%= f.text_field "name", :size => 30 %>
- <%= f.label :other_names %> - - <%= f.text_field "other_names", :size => 30 %> - Separate with commas -
<%= f.label :group_name %><%= f.text_field "group_name", :size => 30 %>
<%= f.label :url_string, "URLs" %><%= f.text_area "url_string", :size => "50x6", :class => "no-block" %>
<%= f.label :notes %> - <%= f.text_area "notes", :size => "50x10", :class => "no-block" %> - <%= link_to "Formatting help", wiki_page_path(:id => "help:dtext") %> -
- <%= submit_tag "Save" %> - <%= button_to_function "Cancel", "history.back()" %> -
+<%= simple_form_for(@artist) do |f| %> + <%= f.input :name %> + <%= f.input :other_names, :hint => "Separate with commas", :as => :text %> + <%= f.input :group_name %> + <%= f.input :url_string, :label => "URLs", :as => :text, :size => "10x5" %> + <%= f.input :notes, :as => :text %> + <%= f.button :submit %> <% end %> \ No newline at end of file diff --git a/app/views/artists/_secondary_nav_links.html.erb b/app/views/artists/_secondary_links.html.erb similarity index 90% rename from app/views/artists/_secondary_nav_links.html.erb rename to app/views/artists/_secondary_links.html.erb index 7ea4f645c..b32c31a7a 100644 --- a/app/views/artists/_secondary_nav_links.html.erb +++ b/app/views/artists/_secondary_links.html.erb @@ -1,4 +1,4 @@ -<% content_for(:secondary_nav_links) do %> +<% content_for(:secondary_links) do %>
  • <%= link_to "Listing", artists_path %>
  • <%= link_to "New", new_artist_path %>
  • diff --git a/app/views/artists/edit.html.erb b/app/views/artists/edit.html.erb index 851b02092..758ac5d86 100644 --- a/app/views/artists/edit.html.erb +++ b/app/views/artists/edit.html.erb @@ -1,3 +1,7 @@ -
    - <%= render :partial => "form" %> +
    +
    + <%= render :partial => "form" %> +
    + +<%= render :partial => "secondary_links" %> diff --git a/app/views/artists/index.html.erb b/app/views/artists/index.html.erb index 12fede550..07968e726 100644 --- a/app/views/artists/index.html.erb +++ b/app/views/artists/index.html.erb @@ -1,35 +1,37 @@ -
    - <%= render :partial => "search" %> +
    +
    + <%= render :partial => "search" %> - - - - - - - - - <% @artists.each do |artist| %> - <% content_tag(:tr, :id => "artist-#{artist.id}") do %> - - +
    Name
    - <%= link_to "P", posts_path(:tags => artist.name), :title => "Find posts for artist" %> - <%= link_to "E", edit_artist_path(artist), :title => "Edit artist" %> - <%= link_to "D", artist_path(artist, :method => :delete, :confirm => "Do you really want to delete this artist?") %> - - <%= link_to h(artist.name), artist_path(artist) %> - <% if !artist.group_name.blank? %> - [<%= link_to(artist.group_name, artist_path(artist)) %>] - <% end %> -
    + + + + + + + + <% @artists.each do |artist| %> + <% content_tag(:tr, :id => "artist-#{artist.id}") do %> + + + <% end %> <% end %> - <% end %> - -
    Name
    + <%= link_to "P", posts_path(:tags => artist.name), :title => "Find posts for artist" %> + <%= link_to "E", edit_artist_path(artist), :title => "Edit artist" %> + <%= link_to "D", artist_path(artist, :method => :delete, :confirm => "Do you really want to delete this artist?") %> + + <%= link_to h(artist.name), artist_path(artist) %> + <% if !artist.group_name.blank? %> + [<%= link_to(artist.group_name, artist_path(artist)) %>] + <% end %> +
    + + -
    - <%= will_paginate(@artists) %> +
    + <%= will_paginate(@artists) %> +
    + + <%= render :partial => "secondary_links" %>
    - - <%= render :partial => "secondary_nav_links" %>
    diff --git a/app/views/artists/new.html.erb b/app/views/artists/new.html.erb index c4cf99a16..2c27eb546 100644 --- a/app/views/artists/new.html.erb +++ b/app/views/artists/new.html.erb @@ -1,5 +1,7 @@ -
    - <%= render :partial => "form" %> +
    +
    + <%= render :partial => "form" %> +
    -<%= render :partial => "secondary_nav_links" %> +<%= render :partial => "secondary_links" %> diff --git a/app/views/artists/show.html.erb b/app/views/artists/show.html.erb index 4a1cafd02..a7d021c4e 100644 --- a/app/views/artists/show.html.erb +++ b/app/views/artists/show.html.erb @@ -1,90 +1,84 @@ -
    -

    Artist: <%= @artist.name.tr("_", " ") %>

    - - <% unless @artist.notes.blank? %> +
    +
    +

    Artist: <%= @artist.name.tr("_", " ") %>

    + + <% unless @artist.notes.blank? %> +
    + <%= format_text(@artist.notes) %> +
    + <% end %> +
    - <%= format_text(@artist.notes) %> -
    - <% end %> - -
    - - - - - - - <% if @artist.has_tag_alias? %> +
    Status - <% if @artist.is_banned? %> - Banned - <% elsif @artist.is_active? %> - Active - <% else %> - Inactive - <% end %> -
    + - - - - <% end %> - <% if !@artist.other_names.blank? %> - - - - - <% end %> - <% if !@artist.group_name.blank? %> - - - - - <% end %> - <% if @artist.members.any? %> - - - - - <% end %> - <% @artist.urls.each do |url| %> - - - + - <% end %> - -
    Tag Alias - <%= @artist.tag_alias_name %> -
    Other Names - <%= link_to_artists(@artist.other_names.split(/,/)) %> -
    Group - <%= link_to_artist(@artist.group_name) %> -
    Members - <%= link_to_artists(@artist.members.map(&:name)) %> -
    URLs - <%= link_to h(url.to_s), h(url.to_s) %> - <% if CurrentUser.user.is_moderator? %> - (<%= link_to("mass edit", mass_edit_admin_posts_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>) + Status + <% if @artist.is_banned? %> + Banned + <% elsif @artist.is_active? %> + Active + <% else %> + Inactive <% end %>
    -
    - -

    * Indicates new artist

    - -
    -

    Recent Posts

    -
    - <%#= @post_set.presenter.post_previews_html %> + <% if @artist.has_tag_alias? %> + + Tag Alias + + <%= @artist.tag_alias_name %> + + + <% end %> + <% if !@artist.other_names.blank? %> + + Other Names + + <%= link_to_artists(@artist.other_names.split(/,/)) %> + + + <% end %> + <% if !@artist.group_name.blank? %> + + Group + + <%= link_to_artist(@artist.group_name) %> + + + <% end %> + <% if @artist.members.any? %> + + Members + + <%= link_to_artists(@artist.members.map(&:name)) %> + + + <% end %> + <% @artist.urls.each do |url| %> + + URLs + + <%= link_to h(url.to_s), h(url.to_s) %> + <% if CurrentUser.user.is_moderator? %> + (<%= link_to("mass edit", mass_edit_admin_posts_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>) + <% end %> + + + <% end %> + +
    + +

    * Indicates new artist

    + +
    +

    Recent Posts

    +
    + <%#= @post_set.presenter.post_previews_html %> +
    +
    + + <%= render :partial => "secondary_links" %>
    - - <% content_for("footer") do %> -
  • |
  • -
  • <%= link_to "Posts", posts_path(:tags => @artist.name) %>
  • -
  • <%= link_to "Edit", edit_artist_path(@artist) %>
  • -
  • <%= link_to "Delete", artist_path(@artist, :method => :delete) %>
  • -
  • <%= link_to "History", artist_versions_path(:artist_id => @artist.id) %>
  • - <% end %> - - <%= render :partial => "secondary_nav_links" %>
    diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 62a03644a..02ba7ddfe 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,41 +1,43 @@ -
    -
    -

    Login

    - <% form_tag(sessions_path) do %> - - - - - - - - - - - - - - - - - -
    <%= submit_tag "Login" %>
    - <%= label_tag :name %> - - <%= text_field_tag :name %> -
    <%= label_tag :password %><%= password_field_tag :password %>
    - <% end %> -
    +
    +
    +
    +

    Login

    + <% form_tag(sessions_path) do %> + + + + + + + + + + + + + + + + + +
    <%= submit_tag "Login" %>
    + <%= label_tag :name %> + + <%= text_field_tag :name %> +
    <%= label_tag :password %><%= password_field_tag :password %>
    + <% end %> +
    - + +
    <% content_for(:page_title) do %> diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb new file mode 100644 index 000000000..040e7e3f1 --- /dev/null +++ b/config/initializers/simple_form.rb @@ -0,0 +1,52 @@ +# Use this setup block to configure all options available in SimpleForm. +SimpleForm.setup do |config| + + # Components used by the form builder to generate a complete input. You can remove + # any of them, change the order, or even add your own components to the stack. + # config.components = [ :label_input, :hint, :error ] + + # Default tag used on hints. + # config.hint_tag = :span + + # Default tag used on errors. + # config.error_tag = :span + + # Method used to tidy up errors. + # config.error_method = :first + + # Default tag used for error notification helper. + # config.error_notification_tag = :p + + # You can wrap all inputs in a pre-defined tag. + # config.wrapper_tag = :div + + # CSS class to add to all wrapper tags. + # config.wrapper_class = :input + + # CSS class to add to the wrapper if the field has errors. + # config.wrapper_error_class = :field_with_errors + + # How the label text should be generated altogether with the required text. + # config.label_text = lambda { |label, required| "#{required} #{label}" } + + # Whether attributes are required by default (or not). Default is true. + # config.required_by_default = true + + # Series of attemps to detect a default label method for collection. + # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] + + # Series of attemps to detect a default value method for collection. + # config.collection_value_methods = [ :id, :to_s ] + + # Collection of methods to detect if a file type was given. + # config.file_methods = [ :file?, :public_filename ] + + # Default priority for time_zone inputs. + # config.time_zone_priority = nil + + # Default priority for country inputs. + # config.country_priority = nil + + # Default size for text inputs. + config.default_input_size = 30 +end diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml new file mode 100644 index 000000000..409e2651d --- /dev/null +++ b/config/locales/simple_form.en.yml @@ -0,0 +1,24 @@ +en: + simple_form: + "yes": 'Yes' + "no": 'No' + required: + text: 'required' + mark: '*' + # You can uncomment the line below if you need to overwrite the whole required html. + # When using html, text and mark won't be used. + # html: '*' + error_notification: + default_message: "Some errors were found, please take a look:" + # Labels and hints examples + # labels: + # password: 'Password' + # user: + # new: + # email: 'E-mail para efetuar o sign in.' + # edit: + # email: 'E-mail.' + # hints: + # username: 'User name to sign in.' + # password: 'No special characters, please.' + diff --git a/lib/templates/erb/scaffold/_form.html.erb b/lib/templates/erb/scaffold/_form.html.erb new file mode 100644 index 000000000..62de5dff8 --- /dev/null +++ b/lib/templates/erb/scaffold/_form.html.erb @@ -0,0 +1,23 @@ +<%%= simple_form_for(@<%= singular_name %>) do |f| %> + <%% if @<%= singular_name %>.errors.any? %> +
    +

    <%%= pluralize(@<%= singular_name %>.errors.count, "error") %> prohibited this <%= singular_name %> from being saved:

    + +
      + <%% @<%= singular_name %>.errors.full_messages.each do |msg| %> +
    • <%%= msg %>
    • + <%% end %> +
    +
    + <%% end %> + +
    + <%- attributes.each do |attribute| -%> + <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> + <%- end -%> +
    + +
    + <%%= f.button :submit %> +
    +<%% end %> diff --git a/public/stylesheets/compiled/default.css b/public/stylesheets/compiled/default.css index 10389ab8e..adf90659e 100644 --- a/public/stylesheets/compiled/default.css +++ b/public/stylesheets/compiled/default.css @@ -85,7 +85,7 @@ img { border: none; vertical-align: middle; } -input[type=text], input[type=password], textarea, button { +input[type=text], input[type=password], input[type=url], textarea, button { border: 1px solid #AAA; font-size: 1em; -moz-border-radius: 4px; @@ -100,6 +100,9 @@ input[type=submit] { font-size: 1em; cursor: pointer; } +input:focus, textarea:focus { + background-color: #FFD; } + input[type=submit]:hover { background-color: #F6F6F6; } @@ -154,6 +157,28 @@ aside.sidebar > section > ul li { aside.sidebar > section > ul ul li { margin-left: 1em; } +/*** Simple Form ***/ +form.simple_form input[type=submit] { + margin-left: 10em; } +form.simple_form div.input { + margin-bottom: 0.5em; } + form.simple_form div.input input, form.simple_form div.input textarea { + width: 300px; } + form.simple_form div.input textarea { + height: 100px; } + form.simple_form div.input label { + vertical-align: top; + display: inline-block; + width: 10em; + cursor: pointer; + font-weight: bold; } + form.simple_form div.input span.hint { + margin-left: 10em; + color: #666; + font-style: italic; + vertical-align: top; + display: block; } + /*** Comments ***/ div.comment-response > div { margin-top: 1em; } diff --git a/public/stylesheets/src/default.scss b/public/stylesheets/src/default.scss index 0a28fcd65..6ab838948 100644 --- a/public/stylesheets/src/default.scss +++ b/public/stylesheets/src/default.scss @@ -110,7 +110,7 @@ img { vertical-align: middle; } -input[type=text], input[type=password], textarea, button { +input[type=text], input[type=password], input[type=url], textarea, button { border: 1px solid #AAA; font-size: 1em; -moz-border-radius: 4px; @@ -127,6 +127,10 @@ input[type=submit] { cursor: pointer; } +input:focus, textarea:focus { + background-color: #FFD; +} + input[type=submit]:hover { background-color: #F6F6F6; } @@ -203,6 +207,42 @@ aside.sidebar > section > ul ul li { } +/*** Simple Form ***/ +form.simple_form { + input[type=submit] { + margin-left: 10em; + } + + div.input { + margin-bottom: 0.5em; + + input, textarea { + width: 300px; + } + + textarea { + height: 100px; + } + + label { + vertical-align: top; + display: inline-block; + width: 10em; + cursor: pointer; + font-weight: bold; + } + + span.hint { + margin-left: 10em; + color: #666; + font-style: italic; + vertical-align: top; + display: block; + } + } +} + + /*** Comments ***/ div.comment-response { } diff --git a/script/custom/watch_stylesheets b/script/custom/watch_stylesheets new file mode 100755 index 000000000..26eac9ea7 --- /dev/null +++ b/script/custom/watch_stylesheets @@ -0,0 +1,3 @@ +#!/bin/sh + +sass --watch public/stylesheets/src/default.scss:public/stylesheets/compiled/default.css