arcadex 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76d7606a57e1a5ec7c7cb64b8dde2bba67086e87
4
- data.tar.gz: c04a13f9712b001f4c27149e4e2289e4b9310e69
3
+ metadata.gz: 2c442427cd754bb9ba4ee0fee7942b951e20d921
4
+ data.tar.gz: e6d32df54d17591f7e519614192411ab08818c0d
5
5
  SHA512:
6
- metadata.gz: 547e1fed79f10cc9100970f3aa7523dfc8625afa47e8fe6df81aacb6a797c13b85fe1ca17bf07d7f8cab22008ebda08c701cf5e337bfe24c5da1871b23fb3026
7
- data.tar.gz: 76ab77ba76a7696c7ad8b17229f8f73ba2f5ba051bbe72faccb80ef37a348cb998ddc392c7efa57e1d2d6c2a69709a8b2be69183845c481966e4011825862b54
6
+ metadata.gz: b2e8c1ebb40634d5943c29e75ad08d1d5a2316b569ac48485f799d22e6150fd1b1af12c0e1e1fe9f7cf1ba8045c011adb257434157a30592691408ffd76db80d
7
+ data.tar.gz: bf05768ad84de18061e31590441190aacdc328900d52605d82e9dc64f2119bc3837828367bc1eadcd72c7ed9469d37ec34302bb50689b554ba5c3c54863f41aa
@@ -0,0 +1,62 @@
1
+ require_dependency "arcadex/application_controller"
2
+
3
+ module Arcadex
4
+ class TokensController < ApplicationController
5
+ before_action :set_token, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /tokens
8
+ def index
9
+ @tokens = Token.all
10
+ end
11
+
12
+ # GET /tokens/1
13
+ def show
14
+ end
15
+
16
+ # GET /tokens/new
17
+ def new
18
+ @token = Token.new
19
+ end
20
+
21
+ # GET /tokens/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /tokens
26
+ def create
27
+ @token = Token.new(token_params)
28
+
29
+ if @token.save
30
+ redirect_to @token, notice: 'Token was successfully created.'
31
+ else
32
+ render action: 'new'
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /tokens/1
37
+ def update
38
+ if @token.update(token_params)
39
+ redirect_to @token, notice: 'Token was successfully updated.'
40
+ else
41
+ render action: 'edit'
42
+ end
43
+ end
44
+
45
+ # DELETE /tokens/1
46
+ def destroy
47
+ @token.destroy
48
+ redirect_to tokens_url, notice: 'Token was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_token
54
+ @token = Token.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def token_params
59
+ params.require(:token).permit(:imageable_id, :imageable_type, :auth_token)
60
+ end
61
+ end
62
+ end
@@ -7,7 +7,7 @@ module Arcadex
7
7
  validates :imageable_id, presence: true
8
8
  validates :imageable_type, presence: true
9
9
  validates :auth_token, presence: true
10
- #This also needs to exist at the database level
10
+ #This also happens at the database level
11
11
  validates :auth_token, uniqueness: true
12
12
 
13
13
  def generate_hash
@@ -0,0 +1,29 @@
1
+ <%= form_for(@token) do |f| %>
2
+ <% if @token.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@token.errors.count, "error") %> prohibited this token from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @token.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :imageable_id %><br>
16
+ <%= f.text_field :imageable_id %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :imageable_type %><br>
20
+ <%= f.text_field :imageable_type %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :auth_token %><br>
24
+ <%= f.text_field :auth_token %>
25
+ </div>
26
+ <div class="actions">
27
+ <%= f.submit %>
28
+ </div>
29
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing token</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @token %> |
6
+ <%= link_to 'Back', tokens_path %>
@@ -0,0 +1,31 @@
1
+ <h1>Listing tokens</h1>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>Imageable_id</th>
7
+ <th>Imageable_type</th>
8
+ <th>Auth_token</th>
9
+ <th></th>
10
+ <th></th>
11
+ <th></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody>
16
+ <% @tokens.each do |token| %>
17
+ <tr>
18
+ <td><%= token.imageable_id %></td>
19
+ <td><%= token.imageable_type %></td>
20
+ <td><%= token.auth_token %></td>
21
+ <td><%= link_to 'Show', token %></td>
22
+ <td><%= link_to 'Edit', edit_token_path(token) %></td>
23
+ <td><%= link_to 'Destroy', token, method: :delete, data: { confirm: 'Are you sure?' } %></td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+
29
+ <br>
30
+
31
+ <%= link_to 'New Token', new_token_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New token</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', tokens_path %>
@@ -0,0 +1,19 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Imageable_id:</strong>
5
+ <%= @token.imageable_id %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Imageable_type:</strong>
10
+ <%= @token.imageable_type %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>Auth_token:</strong>
15
+ <%= @token.auth_token %>
16
+ </p>
17
+
18
+ <%= link_to 'Edit', edit_token_path(@token) %> |
19
+ <%= link_to 'Back', tokens_path %>
data/config/routes.rb CHANGED
@@ -1,2 +1,7 @@
1
1
  Arcadex::Engine.routes.draw do
2
+ root to: "tokens#index"
3
+
4
+ scope 'admin' do
5
+ resources :tokens
6
+ end
2
7
  end
@@ -1,3 +1,3 @@
1
1
  module Arcadex
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arcadex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cleophus Robinson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -67,9 +67,15 @@ files:
67
67
  - app/assets/javascripts/arcadex/application.js
68
68
  - app/assets/stylesheets/arcadex/application.css
69
69
  - app/controllers/arcadex/application_controller.rb
70
+ - app/controllers/arcadex/tokens_controller.rb
70
71
  - app/helpers/arcadex/application_helper.rb
71
72
  - app/models/arcadex/token.rb
72
- - app/views/layouts/arcadex/application.html.erb
73
+ - app/views/arcadex/tokens/_form.html.erb
74
+ - app/views/arcadex/tokens/edit.html.erb
75
+ - app/views/arcadex/tokens/index.html.erb
76
+ - app/views/arcadex/tokens/new.html.erb
77
+ - app/views/arcadex/tokens/show.html.erb
78
+ - app/views/layouts/arcadex/default/application.html.erb
73
79
  - config/routes.rb
74
80
  - db/migrate/20140806194834_create_arcadex_tokens.rb
75
81
  - db/migrate/20140806202340_add_index_to_token.rb