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 +4 -4
- data/app/controllers/arcadex/tokens_controller.rb +62 -0
- data/app/models/arcadex/token.rb +1 -1
- data/app/views/arcadex/tokens/_form.html.erb +29 -0
- data/app/views/arcadex/tokens/edit.html.erb +6 -0
- data/app/views/arcadex/tokens/index.html.erb +31 -0
- data/app/views/arcadex/tokens/new.html.erb +5 -0
- data/app/views/arcadex/tokens/show.html.erb +19 -0
- data/app/views/layouts/arcadex/{application.html.erb → default/application.html.erb} +0 -0
- data/config/routes.rb +5 -0
- data/lib/arcadex/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c442427cd754bb9ba4ee0fee7942b951e20d921
|
4
|
+
data.tar.gz: e6d32df54d17591f7e519614192411ab08818c0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/app/models/arcadex/token.rb
CHANGED
@@ -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
|
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,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,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 %>
|
File without changes
|
data/config/routes.rb
CHANGED
data/lib/arcadex/version.rb
CHANGED
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.
|
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-
|
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/
|
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
|