diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index ae6aeae..dd6d3cb 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,21 +1,26 @@ /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * *= require bootstrap.min *= require_tree . *= require_self */ /* Make sure navbar does not overlay body */ body { padding-top: 70px; } + +/* Reset bootstrap's help cursor on control links */ +table a abbr[title] { + cursor: pointer; +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 876d94e..16438f8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,35 @@ module ApplicationHelper def can_edit?(object) return true if admin? return true unless object.respond_to?(:editable?) object.editable? end + + def link_to_edit(*args, &block) + link_to(abbr_glyph(:pencil, 'Edit'), *args, &block) + end + + def link_to_destroy(*args, &block) + link_to(abbr_glyph(:remove, 'Remove'), *args, &block) + end + + def link_to_enable(*args, &block) + link_to(abbr_glyph(:'eye-close', 'Enable'), *args, &block) + end + + def link_to_disable(*args, &block) + link_to(abbr_glyph(:'eye-open', 'Disable'), *args, &block) + end + + def glyph(icon) + content_tag(:span, '', class: "glyphicon glyphicon-#{icon}") + end + + private + + def abbr_glyph(icon, title) + content_tag(:abbr, glyph(icon), title: title) + end + end diff --git a/app/views/domains/index.html.erb b/app/views/domains/index.html.erb index f6d30d5..7c7d6dc 100644 --- a/app/views/domains/index.html.erb +++ b/app/views/domains/index.html.erb @@ -1,31 +1,31 @@ <% @domains.group_by(&:group).each do |group, domains| %> <% domains.each do |domain| %> - - + + <% end %> <% end %>
<%= link_to group.name, group_path(group) %> Controls
<%= link_to domain.name, domain %> <% if domain.reverse? %> <% else %> <% end %> <%= link_to 'Edit', edit_domain_path(domain) %><%= link_to 'Destroy', domain, method: :delete, data: { confirm: 'Are you sure?' } %><%= link_to_edit edit_domain_path(domain) %><%= link_to_destroy domain, method: :delete, data: { confirm: 'Are you sure?' } %>

<%= link_to 'New Domain »'.html_safe, new_domain_path, class: 'btn btn-lg btn-primary' %>

diff --git a/app/views/domains/show.html.erb b/app/views/domains/show.html.erb index e866df0..5fb742f 100644 --- a/app/views/domains/show.html.erb +++ b/app/views/domains/show.html.erb @@ -1,37 +1,37 @@ <% @domain.records.each do |record| %> <% if can_edit?(record) %> - - + + <% else %> <% end %>
Records Controls
<%= record.name %> IN <%= record.type %> <%= record.supports_prio? ? record.prio : '' %> <%= record.content %> <% if record.disabled? %> - <%= link_to 'Enable', enable_domain_record_path(@domain, record), method: :put %> + <%= link_to_enable enable_domain_record_path(@domain, record), method: :put %> <% else %> - <%= link_to 'Disable', disable_domain_record_path(@domain, record), method: :put %> + <%= link_to_disable disable_domain_record_path(@domain, record), method: :put %> <% end %> <%= link_to 'Edit', edit_domain_record_path(@domain, record) if can_edit?(record) %><%= link_to 'Remove', [@domain, record], method: :delete, data: { confirm: 'Are you sure?' } %><%= link_to_edit edit_domain_record_path(@domain, record) if can_edit?(record) %><%= link_to_destroy [@domain, record], method: :delete, data: { confirm: 'Are you sure?' } %> <% end %>

<%= link_to 'New Record', new_domain_record_path(@domain) %>

diff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erb index 8f0df1f..1c1bcdd 100644 --- a/app/views/groups/show.html.erb +++ b/app/views/groups/show.html.erb @@ -1,24 +1,24 @@ <% @group.memberships.includes(:user).each do |membership| %> <% end %>
Members Controls
<%= membership.user.email %><%= " (you)" if current_user == membership.user %> - <%= link_to 'x', destroy_member_group_path(@group, membership.user_id), method: :delete %> + <%= link_to_destroy destroy_member_group_path(@group, membership.user_id), method: :delete %>
<%= bootstrap_form_tag(url: create_member_group_path(@group), layout: :inline) do |f| %> <%= f.text_field :email, prepend: 'Member', hide_label: true, id: 'js-search-member', data: { group: @group.id } %> <%= f.submit 'Add', class: 'btn btn-primary' %> <% end %>