From c505426d1fbf853f5e6b596cf72a298621642591 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 28 Oct 2014 00:33:24 +0300 Subject: [PATCH] #369: updated UI for Tokens --- .../platforms/tokens_controller.rb | 2 + app/views/platforms/tokens/index.html.haml | 21 --------- app/views/platforms/tokens/index.html.slim | 24 ++++++++++ app/views/platforms/tokens/new.html.haml | 16 ------- app/views/platforms/tokens/new.html.slim | 15 +++++++ app/views/platforms/tokens/show.html.haml | 41 ----------------- app/views/platforms/tokens/show.html.slim | 45 +++++++++++++++++++ 7 files changed, 86 insertions(+), 78 deletions(-) delete mode 100644 app/views/platforms/tokens/index.html.haml create mode 100644 app/views/platforms/tokens/index.html.slim delete mode 100644 app/views/platforms/tokens/new.html.haml create mode 100644 app/views/platforms/tokens/new.html.slim delete mode 100644 app/views/platforms/tokens/show.html.haml create mode 100644 app/views/platforms/tokens/show.html.slim diff --git a/app/controllers/platforms/tokens_controller.rb b/app/controllers/platforms/tokens_controller.rb index 636f626a3..26816deb2 100644 --- a/app/controllers/platforms/tokens_controller.rb +++ b/app/controllers/platforms/tokens_controller.rb @@ -1,4 +1,6 @@ class Platforms::TokensController < Platforms::BaseController + layout 'bootstrap' + before_filter :authenticate_user! load_resource :platform diff --git a/app/views/platforms/tokens/index.html.haml b/app/views/platforms/tokens/index.html.haml deleted file mode 100644 index e759bcf4f..000000000 --- a/app/views/platforms/tokens/index.html.haml +++ /dev/null @@ -1,21 +0,0 @@ --set_meta_tags title: [title_object(@platform), t('layout.tokens.header')] -= render 'submenu' -= render 'sidebar' -= link_to t('layout.tokens.new'), new_platform_token_path(@platform), class: 'button' - -%table#myTable.tablesorter.tokens{cellspacing: "0", cellpadding: "0"} - %thead - %tr - %th= t('activerecord.attributes.token.description') - %th.th2= t('activerecord.attributes.token.creator') - %th= t('activerecord.attributes.token.status') - %th - %tbody - - @tokens.each do |token| - %tr{class: cycle('odd', 'even')} - %td= truncate token.description, length: 50 - %td= link_to token.creator.try(:fullname), token.creator - %td= t("layout.tokens.statuses.#{token.status}") - %td= link_to t('layout.show'), platform_token_path(@platform, token) - -= will_paginate @tokens diff --git a/app/views/platforms/tokens/index.html.slim b/app/views/platforms/tokens/index.html.slim new file mode 100644 index 000000000..9a5172f81 --- /dev/null +++ b/app/views/platforms/tokens/index.html.slim @@ -0,0 +1,24 @@ +- set_meta_tags title: [title_object(@platform), t('layout.tokens.header')] += render 'submenu' +.container + .row + a.btn.btn-primary href=new_platform_token_path(@platform) + = t('layout.tokens.new') + + .row + table.table.table-striped + thead + tr + th= t('activerecord.attributes.token.description') + th= t('activerecord.attributes.token.creator') + th= t('activerecord.attributes.token.status') + th + tbody + - @tokens.each do |token| + tr + td= truncate token.description, length: 50 + td= link_to token.creator.try(:fullname), token.creator + td= t("layout.tokens.statuses.#{token.status}") + td= link_to t('layout.show'), platform_token_path(@platform, token) + + = will_paginate @tokens diff --git a/app/views/platforms/tokens/new.html.haml b/app/views/platforms/tokens/new.html.haml deleted file mode 100644 index f48c73f46..000000000 --- a/app/views/platforms/tokens/new.html.haml +++ /dev/null @@ -1,16 +0,0 @@ --set_meta_tags title: [title_object(@platform), t('layout.tokens.new')] -= render 'submenu' -= render 'sidebar' - -%h3= t('layout.tokens.new') - -= form_for @token, url: platform_tokens_path(@platform), method: :post, html: { class: :form } do |f| - .leftlist= f.label :description - .rightlist= f.text_area :description - - .both - .hr - .button_block - = submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} - %span.text_button_padding= t('layout.or') - = link_to t('layout.cancel'), platform_tokens_path(@platform), class: 'button' diff --git a/app/views/platforms/tokens/new.html.slim b/app/views/platforms/tokens/new.html.slim new file mode 100644 index 000000000..c71102238 --- /dev/null +++ b/app/views/platforms/tokens/new.html.slim @@ -0,0 +1,15 @@ +-set_meta_tags title: [title_object(@platform), t('layout.tokens.new')] += render 'submenu' + +.container + .row + h3 + = t('layout.tokens.new') + + = simple_form_for @token, url: platform_tokens_path(@platform) do |f| + fieldset + = f.input :description, as: :text + + .button_block + button type="submit" class="btn btn-default" data-disable-with=t('layout.saving') + = t('layout.save') diff --git a/app/views/platforms/tokens/show.html.haml b/app/views/platforms/tokens/show.html.haml deleted file mode 100644 index a0263dc3a..000000000 --- a/app/views/platforms/tokens/show.html.haml +++ /dev/null @@ -1,41 +0,0 @@ --set_meta_tags title: [title_object(@platform), t('layout.tokens.header')] -= render 'submenu' -= render 'sidebar' - -%h3.fix= "#{t('layout.tokens.about')} #{@platform.name}" - -%p= @token.description - -%table.tablesorter.unbordered - %tr - %td - %b= "#{t('activerecord.attributes.token.creator')}:" - %td= link_to @token.creator.try(:name), @token.creator - %tr - %td - %b= "#{t('activerecord.attributes.token.created_at')}:" - %td= @token.created_at - - if @token.updater - %tr - %td - %b= "#{t('activerecord.attributes.token.updater')}:" - %td= link_to @token.updater.try(:name), @token.updater if @token.updater - %tr - %td - %b= "#{t('activerecord.attributes.token.updated_at')}:" - %td= @token.updated_at - %tr - %td - %b= "#{t('activerecord.attributes.token.status')}:" - %td= t("layout.tokens.statuses.#{@token.status}") - %tr - %td - %b= "#{t('activerecord.attributes.token.authentication_token')}:" - %td= @token.authentication_token - -- if @token.active? - .buttons_block - = link_to t('layout.tokens.withdraw'), - withdraw_platform_token_path(@platform, @token), - method: :post, class: 'button', - data: { confirm: t('layout.tokens.withdraw_confirm') } diff --git a/app/views/platforms/tokens/show.html.slim b/app/views/platforms/tokens/show.html.slim new file mode 100644 index 000000000..b7cb69bcb --- /dev/null +++ b/app/views/platforms/tokens/show.html.slim @@ -0,0 +1,45 @@ +-set_meta_tags title: [title_object(@platform), t('layout.tokens.header')] += render 'submenu' + +.container + .row + h3 + = t('layout.tokens.about') + |   + = @platform.name + + p= @token.description + + table.table.table-striped + tr + td + b= t('activerecord.attributes.token.creator') + td= link_to @token.creator.try(:name), @token.creator + tr + td + b= t('activerecord.attributes.token.created_at') + td= @token.created_at + - if @token.updater + tr + td + b= t('activerecord.attributes.token.updater') + td= link_to @token.updater.try(:name), @token.updater if @token.updater + tr + td + b= t('activerecord.attributes.token.updated_at') + td= @token.updated_at + tr + td + b= t('activerecord.attributes.token.status') + td= t("layout.tokens.statuses.#{@token.status}") + tr + td + b= t('activerecord.attributes.token.authentication_token') + td= @token.authentication_token + + - if @token.active? + .buttons_block + = link_to t('layout.tokens.withdraw'), + withdraw_platform_token_path(@platform, @token), + method: :post, class: 'btn btn-danger', + data: { confirm: t('layout.tokens.withdraw_confirm') }