#369: updated UI for Tokens

This commit is contained in:
Vokhmin Alexey V 2014-10-28 00:33:24 +03:00
parent b4f6129951
commit c505426d1f
7 changed files with 86 additions and 78 deletions

View File

@ -1,4 +1,6 @@
class Platforms::TokensController < Platforms::BaseController
layout 'bootstrap'
before_filter :authenticate_user!
load_resource :platform

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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')

View File

@ -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') }

View File

@ -0,0 +1,45 @@
-set_meta_tags title: [title_object(@platform), t('layout.tokens.header')]
= render 'submenu'
.container
.row
h3
= t('layout.tokens.about')
| &nbsp;
= @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') }