From 87e9ccbcdf4f99dd898b0715750092a27fff7e94 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 4 Jul 2014 15:40:54 +0200 Subject: Enable unblocking handles in identities tab There's an identities tab now for admins that will allow unblocking blocked handles. It should be easy to expand for aliases and forwards and other types of actions such as editing. --- app/views/common/_action.html.haml | 2 ++ app/views/common/_navigation_item.html.haml | 3 +++ app/views/common/_table.html.haml | 18 ++++++++++++++++++ app/views/identities/_identity.html.haml | 7 +++++++ app/views/identities/index.html.haml | 4 ++++ app/views/layouts/_admin_navigation_item.html.haml | 3 +++ app/views/layouts/_header.html.haml | 6 +----- 7 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 app/views/common/_action.html.haml create mode 100644 app/views/common/_navigation_item.html.haml create mode 100644 app/views/common/_table.html.haml create mode 100644 app/views/identities/_identity.html.haml create mode 100644 app/views/identities/index.html.haml create mode 100644 app/views/layouts/_admin_navigation_item.html.haml (limited to 'app/views') diff --git a/app/views/common/_action.html.haml b/app/views/common/_action.html.haml new file mode 100644 index 0000000..71ffd96 --- /dev/null +++ b/app/views/common/_action.html.haml @@ -0,0 +1,2 @@ +%li.action{class: action.class} + =link_to action.label, action.url, action.html_options diff --git a/app/views/common/_navigation_item.html.haml b/app/views/common/_navigation_item.html.haml new file mode 100644 index 0000000..02c54c8 --- /dev/null +++ b/app/views/common/_navigation_item.html.haml @@ -0,0 +1,3 @@ +- item = navigation_item.to_s +%li{:class => ("active" if controller?(item))} + = link_to t(".#{item}", cascade: true), polymorphic_url(item) diff --git a/app/views/common/_table.html.haml b/app/views/common/_table.html.haml new file mode 100644 index 0000000..3c6bf2e --- /dev/null +++ b/app/views/common/_table.html.haml @@ -0,0 +1,18 @@ +-# +-# A simple table with headers, content and a message if there is no +-# content. +-# You can use the table helper method to translate the headers and +-# error message. +-# +%table.table.table-striped.table-bordered + %thead + %tr + - headers.each do |header| + %th= header + %tbody + - if content.any? + = render content.all + - else + %tr + %td{:colspan=>headers.count}= none + diff --git a/app/views/identities/_identity.html.haml b/app/views/identities/_identity.html.haml new file mode 100644 index 0000000..7c4aeda --- /dev/null +++ b/app/views/identities/_identity.html.haml @@ -0,0 +1,7 @@ +%tr[identity]{class: identity.status} + %td + %span.label= t(".#{identity.status}", cascading: true) + %td= identity.login + %td= identity.destination + %td + %ul.list-inline= render actions(identity) diff --git a/app/views/identities/index.html.haml b/app/views/identities/index.html.haml new file mode 100644 index 0000000..cabcccd --- /dev/null +++ b/app/views/identities/index.html.haml @@ -0,0 +1,4 @@ +-@show_navigation = false + += table @identities, %w(type username destination actions) +-# = paginate @identities diff --git a/app/views/layouts/_admin_navigation_item.html.haml b/app/views/layouts/_admin_navigation_item.html.haml new file mode 100644 index 0000000..8dd8a39 --- /dev/null +++ b/app/views/layouts/_admin_navigation_item.html.haml @@ -0,0 +1,3 @@ +- item = admin_navigation_item.to_s +%li{:class => ("active" if controller?(item))} + = link_to t(".#{item}", cascade: true), path_for(item) diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index e827f60..ff14af9 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -1,10 +1,6 @@ - if admin? %ul.nav.nav-tabs - = # this navigation isn't quite right. also, we will want to active for an identity controller once it is added. - %li{:class => ("active" if controller?('users', 'overviews') || params[:user_id])} - = link_to t(".users"), users_path - %li{:class => ("active" if controller?('tickets') && !params[:user_id])} - = link_to t(".tickets", cascade: true), tickets_path + = render partial: 'common/navigation_item', collection: [:users, :identities, :tickets] %li = link_to t(:logout), logout_path, :method => :delete - if @user && @show_navigation -- cgit v1.2.3 From bdb4b0e275c205b0b44bbe3cc4ec4c162b309b37 Mon Sep 17 00:00:00 2001 From: Azul Date: Sat, 5 Jul 2014 11:41:43 +0200 Subject: make link_to_navigation more generic and reuse it Use link_to_navigation for all important navigation items. It creates a link in a list item for use with bootstrap. It supports an :active flag and an :icon option in the html_options now. It also translates the label. This way it can be used in a lot of places as the generic navigation link. --- app/views/common/_navigation_item.html.haml | 10 ++++++++-- app/views/layouts/_header.html.haml | 6 +++--- app/views/layouts/_navigation.html.haml | 15 ++++++++++----- 3 files changed, 21 insertions(+), 10 deletions(-) (limited to 'app/views') diff --git a/app/views/common/_navigation_item.html.haml b/app/views/common/_navigation_item.html.haml index 02c54c8..39b20d7 100644 --- a/app/views/common/_navigation_item.html.haml +++ b/app/views/common/_navigation_item.html.haml @@ -1,3 +1,9 @@ +-# +-# A very simple navigation link. It takes a symbol, uses it for the +-# translation, path and determining if the link is active. +-# +-# For something more complex use link_to_navigation directly instead. +-# - item = navigation_item.to_s -%li{:class => ("active" if controller?(item))} - = link_to t(".#{item}", cascade: true), polymorphic_url(item) += link_to_navigation ".#{item}", polymorphic_url(item), + active: controller?(item) diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index ff14af9..7b7999a 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -1,8 +1,8 @@ - if admin? %ul.nav.nav-tabs - = render partial: 'common/navigation_item', collection: [:users, :identities, :tickets] - %li - = link_to t(:logout), logout_path, :method => :delete + = render partial: 'common/navigation_item', + collection: [:users, :identities, :tickets] + = link_to_navigation :logout, logout_path, :method => :delete - if @user && @show_navigation .lead = @user.email_address diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 94f71f7..dccba0c 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -1,7 +1,12 @@ %ul.nav.sidenav - = link_to_navigation t(:overview), @user, :active => (controller?(:users) && action?(:show)) - = link_to_navigation t(:account_settings), edit_user_path(@user), :active => (controller?(:users) && !action?(:show)) + = link_to_navigation :overview, @user, + active: (controller?(:users) && action?(:show)) + = link_to_navigation :account_settings, edit_user_path(@user), + active: (controller?(:users) && !action?(:show)) - # will want link for identity settings - = link_to_navigation t(".tickets"), auto_tickets_path, :active => controller?(:tickets) - = link_to_navigation t(:billing_settings), billing_top_link(@user), :active => controller?(:customer, :payments, :subscriptions, :credit_card_info) if APP_CONFIG[:billing] - = link_to_navigation t(:logout), logout_path, :method => :delete + = link_to_navigation ".tickets", auto_tickets_path, + active: controller?(:tickets) + - if APP_CONFIG[:billing] + = link_to_navigation :billing_settings, billing_top_link(@user), + active: controller?(:customer, :payments, :subscriptions, :credit_card_info) + = link_to_navigation :logout, logout_path, method: :delete -- cgit v1.2.3 From 0cc11ebb609de225fbeacbf80788b992b88b6ce6 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 9 Jul 2014 12:51:16 +0200 Subject: list identities based on search only --- app/views/common/_search.html.haml | 8 ++++++++ app/views/common/_table.html.haml | 2 +- app/views/identities/index.html.haml | 1 + app/views/users/index.html.haml | 13 ++----------- 4 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 app/views/common/_search.html.haml (limited to 'app/views') diff --git a/app/views/common/_search.html.haml b/app/views/common/_search.html.haml new file mode 100644 index 0000000..9f14903 --- /dev/null +++ b/app/views/common/_search.html.haml @@ -0,0 +1,8 @@ += form_tag path, :method => :get, :class => "form-search" do + .input-append + = text_field_tag :query, params[:query], + id: "#{id}-typeahead", + class: "search-query", + autocomplete: :off + %button.btn{:type => :submit}= submit_label + diff --git a/app/views/common/_table.html.haml b/app/views/common/_table.html.haml index 3c6bf2e..44762da 100644 --- a/app/views/common/_table.html.haml +++ b/app/views/common/_table.html.haml @@ -10,7 +10,7 @@ - headers.each do |header| %th= header %tbody - - if content.any? + - if content.present? = render content.all - else %tr diff --git a/app/views/identities/index.html.haml b/app/views/identities/index.html.haml index cabcccd..e4f48eb 100644 --- a/app/views/identities/index.html.haml +++ b/app/views/identities/index.html.haml @@ -1,4 +1,5 @@ -@show_navigation = false += search :identities = table @identities, %w(type username destination actions) -# = paginate @identities diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index fc1001e..3ed8835 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,13 +1,4 @@ - @show_navigation = false -= form_tag users_path, :method => :get, :class => "form-search" do - .input-append - = text_field_tag :query, params[:query], :id => 'user-typeahead', :class => "search-query", :autocomplete => :off - %button.btn{:type => :submit}= t(:search) - -%table.table.table-striped - %tr - %th= t(:username) - %th= t(:created) - %th= t(:updated) - = render @users.all += search :users += table @users, %w(username, created, updated) -- cgit v1.2.3