agilib 0.1.4 → 0.1.5

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: 312d5c64afb6264abfc3758140694ae09de4960f
4
- data.tar.gz: 959d572be79a13093dfab2b689a80e1cad642640
3
+ metadata.gz: 957f22bc0492db8d31a2b8b09504dcf17e420848
4
+ data.tar.gz: ce3664959d727aef66671f1b51dc8f16db7c003a
5
5
  SHA512:
6
- metadata.gz: 0677aaf3d389abb2000c107edaea7712ac84d2227e1a857c0c5e08c16acb261d2367c1d865a54192369df55f3171e0518b4f16911c08b39f0370e478b34d0c69
7
- data.tar.gz: a640f4097e3a5aa37d0d6377a5f9e7c53686275b4c08482d97c73d452c4097536f6b05505c82889729d6a63c80920d2837e0d3b8bea1d39724c57fad43839672
6
+ metadata.gz: eb6bfa1133dddae17c0b0432768e79ee130b4d5e4e3f5da56951580bc5afe85eafa612c1ec49a2bd2891aac081b2157b877f198b1f10840753216b80570633d2
7
+ data.tar.gz: c59dece64979d4d424cb7650c7563f5f89f81baba50ebab46d450742d9a7d86eb183d7d7a1d618ac1cda756adab51118b627155d3ebb2d6487d3e5ca12358107
@@ -7,7 +7,7 @@ module Agilib
7
7
  end
8
8
 
9
9
  def index
10
- @devices = @get_devices.all
10
+ @devices = @get_devices
11
11
  respond_with(@devices)
12
12
  end
13
13
 
@@ -27,12 +27,21 @@ module Agilib
27
27
  end
28
28
 
29
29
  def create
30
- @device = @get_devices.build(params[:device])
30
+ if Agilib.rails4?
31
+ @device = @get_devices.build(device_params)
32
+ else
33
+ @device = @get_devices.build(params[:device])
34
+ end
31
35
  respond_with(@device)
32
36
  end
33
37
 
34
38
  def update
35
39
  @device = @get_devices.find(params[:id])
40
+ if Agilib.rails4?
41
+ @device.update(device_params)
42
+ else
43
+ @device.update_attributes(params[:device])
44
+ end
36
45
  respond_with(@device)
37
46
  end
38
47
 
@@ -46,6 +55,9 @@ module Agilib
46
55
  def get_devices
47
56
  @get_devices = current_user.devices
48
57
  end
58
+ def device_params
59
+ params.require(:device).permit(:platform, :register)
60
+ end
49
61
  end
50
62
 
51
63
  end
@@ -1,6 +1,8 @@
1
1
  module Agilib
2
2
  class Device < ActiveRecord::Base
3
3
  belongs_to :user
4
- attr_accessible :platform, :register
4
+ unless Agilib.rails4?
5
+ attr_accessible :platform, :register
6
+ end
5
7
  end
6
8
  end
@@ -1,22 +1,32 @@
1
- <ul class="nav nav-tabs clear-nav-tab steps">
2
- <li class="active"><a href="#coreData"><aside>Dados Principais</aside></a></li>
3
- </ul>
1
+ <%= form_for(@device, :html => { :class => "form-horizontal" }) do |f| %>
2
+ <% if @device.errors.any? %>
3
+ <div class="alert alert-danger alert-dismissable">
4
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
5
+ <h4><%= pluralize(@device.errors.count, "error") %> prohibited this device from being saved:</h4>
4
6
 
5
- <%= simple_form_for @device, :remote => true, :validate => false, :html => { :id => 'form_devices', :class => 'form-horizontal', 'data-type'=>'json' } do |f| %>
6
- <div id="tab-content-device" class="tab-content">
7
-
8
- <!-- TAB DADOS PRINCIPAIS -->
9
- <div class="tab-pane active" id="coreData">
10
- <%= f.association :user %>
11
- <%= f.input :platform %>
12
- <%= f.input :register %>
13
- <%= f.input :deleted_at %>
7
+ <ul>
8
+ <% @device.errors.full_messages.each do |msg| %>
9
+ <li><%= msg %></li>
10
+ <% end %>
11
+ </ul>
14
12
  </div>
13
+ <% end %>
15
14
 
15
+ <div class="form-group">
16
+ <%= f.label :platform, :class => "col-lg-2 control-label" %>
17
+ <div class="col-lg-10">
18
+ <%= f.text_field :platform, :class => "form-control" %>
19
+ </div>
16
20
  </div>
17
-
18
- </div>
19
- <div class="modal-footer">
20
- <%= f.button :submit, :class => 'btn btn-primary' %>
21
+ <div class="form-group">
22
+ <%= f.label :register, :class => "col-lg-2 control-label" %>
23
+ <div class="col-lg-10">
24
+ <%= f.text_field :register, :class => "form-control" %>
25
+ </div>
26
+ </div>
27
+ <div class="form-group">
28
+ <div class="col-lg-offset-2 col-lg-10">
29
+ <%= f.submit :class => "btn btn-primary" %>
30
+ </div>
21
31
  </div>
22
- <% end %>
32
+ <% end %>
@@ -1,6 +1,13 @@
1
- <h1>Editing device</h1>
1
+ <div class="page-header">
2
+ <%= link_to devices_path, :class => 'btn btn-default' do %>
3
+ <span class="glyphicon glyphicon-list-alt"></span>
4
+ Back
5
+ <% end %>
6
+ <%= link_to @device, :class => 'btn btn-primary' do %>
7
+ <span class="glyphicon glyphicon-info-sign"></span>
8
+ Show
9
+ <% end %>
10
+ <h1>Editing device</h1>
11
+ </div>
2
12
 
3
13
  <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @device %> |
6
- <%= link_to 'Back', devices_path %>
@@ -0,0 +1,29 @@
1
+ <div class="page-header">
2
+ <%= link_to new_device_path, :class => 'btn btn-primary' do %>
3
+ <span class="glyphicon glyphicon-plus"></span>
4
+ New User
5
+ <% end %>
6
+ <h1>Listing devices</h1>
7
+ </div>
8
+
9
+ <div class="table-responsive">
10
+ <table class="table table-striped table-bordered table-hover">
11
+ <thead>
12
+ <tr>
13
+ <th>Name</th>
14
+ <th></th>
15
+ <th></th>
16
+ <th></th>
17
+ </tr>
18
+ </thead>
19
+
20
+ <tbody>
21
+ <%= content_tag_for(:tr, @devices) do |device| %>
22
+ <td><%= device.platform %></td>
23
+ <td><%= link_to 'Show', device %></td>
24
+ <td><%= link_to 'Edit', edit_device_path(device) %></td>
25
+ <td><%= link_to 'Destroy', device, method: :delete, data: { confirm: 'Are you sure?' } %></td>
26
+ <% end %>
27
+ </tbody>
28
+ </table>
29
+ </div>
@@ -0,0 +1,4 @@
1
+ json.array!(@devices) do |device|
2
+ json.extract! device, :id, :platform
3
+ json.url device_url(device, format: :json)
4
+ end
@@ -1,5 +1,9 @@
1
- <h1>New device</h1>
1
+ <div class="page-header">
2
+ <%= link_to devices_path, :class => 'btn btn-default' do %>
3
+ <span class="glyphicon glyphicon-list-alt"></span>
4
+ Back
5
+ <% end %>
6
+ <h1>New device</h1>
7
+ </div>
2
8
 
3
9
  <%= render 'form' %>
4
-
5
- <%= link_to 'Back', devices_path %>
@@ -1,25 +1,22 @@
1
- <p id="notice"><%= notice %></p>
1
+ <div class="page-header">
2
+ <%= link_to devices_path, :class => 'btn btn-default' do %>
3
+ <span class="glyphicon glyphicon-list-alt"></span>
4
+ Back
5
+ <% end %>
6
+ <%= link_to edit_device_path(@device), :class => 'btn btn-primary' do %>
7
+ <span class="glyphicon glyphicon-pencil"></span>
8
+ Edit
9
+ <% end %>
10
+ <h1>Show device</h1>
11
+ </div>
2
12
 
3
- <p>
4
- <b>User:</b>
5
- <%= @device.user %>
6
- </p>
13
+ <dl class="dl-horizontal">
14
+ <dt>Platform:</dt>
15
+ <dd><%= @device.platform %></dd>
7
16
 
8
- <p>
9
- <b>Platform:</b>
10
- <%= @device.platform %>
11
- </p>
17
+ </dl>
18
+ <dl class="dl-horizontal">
19
+ <dt>Register:</dt>
20
+ <dd><%= @device.register %></dd>
12
21
 
13
- <p>
14
- <b>Register:</b>
15
- <%= @device.register %>
16
- </p>
17
-
18
- <p>
19
- <b>Deleted at:</b>
20
- <%= @device.deleted_at %>
21
- </p>
22
-
23
-
24
- <%= link_to 'Edit', edit_device_path(@device) %> |
25
- <%= link_to 'Back', devices_path %>
22
+ </dl>
@@ -0,0 +1 @@
1
+ json.extract! @device, :id, :platform, :register, :created_at, :updated_at
@@ -23,6 +23,9 @@ templater.post_bundler do
23
23
 
24
24
 
25
25
  page_css_initial = <<-TEXT
26
+
27
+
28
+
26
29
  .page-header {
27
30
  a.btn {
28
31
  float: right;
@@ -2,7 +2,7 @@ module Agilib
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 4
5
+ PATCH = 5
6
6
  BUILD = ''
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agilib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Junior
@@ -178,8 +178,10 @@ files:
178
178
  - app/views/agilib/devices/_form.html.erb
179
179
  - app/views/agilib/devices/edit.html.erb
180
180
  - app/views/agilib/devices/index.html.erb
181
+ - app/views/agilib/devices/index.json.jbuilder
181
182
  - app/views/agilib/devices/new.html.erb
182
183
  - app/views/agilib/devices/show.html.erb
184
+ - app/views/agilib/devices/show.json.jbuilder
183
185
  - app/views/agilib/welcome/index.html
184
186
  - app/views/agilib/welcome/index.html.erb
185
187
  - bin/agilib