aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/api_keys
diff options
context:
space:
mode:
authorXinhui2017-08-18 14:35:30 +0200
committerXinhui2017-08-18 14:38:09 +0200
commitdba01bf83eed749a96a55bb751245568cd476152 (patch)
tree254b6b8aa22847fb3b2fc8c73bba522417b5744f /app/views/api_keys
parent30b746b8b238c9ba22e972556e94950adb3f5e8b (diff)
downloadchouette-core-dba01bf83eed749a96a55bb751245568cd476152.tar.bz2
Refactoring api_keys views with table_builder
Diffstat (limited to 'app/views/api_keys')
-rw-r--r--app/views/api_keys/edit.html.slim3
-rw-r--r--app/views/api_keys/index.html.slim24
-rw-r--r--app/views/api_keys/new.html.slim3
-rw-r--r--app/views/api_keys/show.html.slim7
4 files changed, 29 insertions, 8 deletions
diff --git a/app/views/api_keys/edit.html.slim b/app/views/api_keys/edit.html.slim
index 110f0775d..e47deddf7 100644
--- a/app/views/api_keys/edit.html.slim
+++ b/app/views/api_keys/edit.html.slim
@@ -1,3 +1,2 @@
= title_tag t('api_keys.edit.title')
-
-== render 'form' \ No newline at end of file
+== render partial: 'form', locals: {action_url: organisation_api_key_path}
diff --git a/app/views/api_keys/index.html.slim b/app/views/api_keys/index.html.slim
new file mode 100644
index 000000000..fc8d95c7a
--- /dev/null
+++ b/app/views/api_keys/index.html.slim
@@ -0,0 +1,24 @@
+- header_params = ['map-marker',
+ t('.title'),
+ '']
+- header_params << link_to(t('actions.add'), new_organisation_api_key_path, class: 'btn btn-default') if policy(Api::V1::ApiKey).create?
+= pageheader(*header_params) do
+
+
+- if @api_keys.any?
+ .row
+ .col-lg-12
+ = table_builder_2 @api_keys,
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :name, \
+ attribute: 'name' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :token, \
+ attribute: 'token' \
+ ), \
+ ],
+ cls: 'table has-search'
+
+ = new_pagination @api_keys, 'pull-right'
diff --git a/app/views/api_keys/new.html.slim b/app/views/api_keys/new.html.slim
index f7b1dd99b..291c9f8a6 100644
--- a/app/views/api_keys/new.html.slim
+++ b/app/views/api_keys/new.html.slim
@@ -1,3 +1,2 @@
= title_tag t('api_keys.new.title')
-
-== render "form" \ No newline at end of file
+== render partial: 'form', locals: {action_url: organisation_api_keys_path}
diff --git a/app/views/api_keys/show.html.slim b/app/views/api_keys/show.html.slim
index b65717408..de30ac125 100644
--- a/app/views/api_keys/show.html.slim
+++ b/app/views/api_keys/show.html.slim
@@ -12,7 +12,6 @@
- content_for :sidebar do
ul.actions
- li = link_to t('api_keys.actions.new'), new_referential_api_key_path(@referential), class: "add"
- li = link_to t('api_keys.actions.edit'), edit_referential_api_key_path(@referential, @api_key), class: "edit"
- li = link_to t('api_keys.actions.destroy'), referential_api_key_path(@referential, @api_key), :method => :delete, :data => {:confirm => t('api_keys.actions.destroy_confirm')}, class: "remove"
- br \ No newline at end of file
+ li = link_to t('api_keys.actions.edit'), edit_organisation_api_key_path(@api_key), class: "edit"
+ li = link_to t('api_keys.actions.destroy'), organisation_api_key_path(@api_key), :method => :delete, :data => {:confirm => t('api_keys.actions.destroy_confirm')}, class: "remove"
+ br