tenon 1.0.26 → 1.0.27

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: 59380735084a650c2c794fb1a0a72c1d1d0bc73a
4
- data.tar.gz: 54eab279b37418af5e3a3bc384eb2249b71b6cce
3
+ metadata.gz: 34e1b1b1ecbd92e365d323988b5e9bafb32e19c1
4
+ data.tar.gz: e068e258a9520d70e0c9acf36afb870a4cbb13cf
5
5
  SHA512:
6
- metadata.gz: a7878190e20b7aeb1b95da78e296978e9ce41277ca62a93462c645aec61f407e4660a2c76f947236194e6c7010764bcb052d874e840c6360e0c74679af37ebc5
7
- data.tar.gz: fdef04a1371acec78eec16f3c8577382db7af86642f318f195a08aac72473d52630ea87d3482c0ca8692dbb0d9e60091c7f4fc17895622b74fdbbf109ae538c1
6
+ metadata.gz: ea19fd36996e7c42de91645ec5e67cc5b38c5865d2970772d4f7a84d2fd0cc6c469d10113809f59fe2d0c0be73cf7fe4f19ed16908f345a5b5c1599db31a42f3
7
+ data.tar.gz: a6fb89c25554d018a19ad6b2b9941c6a2c979daf1e2bb6b2ef3fa3410c6bfbdeba6af8ad934dfb1346c6d2e6d008a9ed8462f02a3dbdda7b9c02a5a016d7327d
@@ -3,14 +3,12 @@
3
3
  <div class="record-actions">
4
4
  <%- @redirect.delete_link %>
5
5
  <%- @redirect.edit_link %>
6
- <% if @redirect.active == true: %>
7
- <a data-tooltip="Active"><i class="fa fa-eye fa-fw"></i></span>
8
- <% end %>
6
+ <%- @redirect.active_link %>
9
7
  </div>
10
8
 
11
9
  <div class="record-title">
12
10
  <a href="<%= @redirect.edit_path %>">
13
- /<%= @redirect.in %>/
11
+ <%= @redirect.in %>
14
12
  <i class="fa fa-long-arrow-right" style="margin: 0 20px; opacity:0.3;" />
15
13
  <%= @redirect.out %>
16
14
  </a>
@@ -4,6 +4,18 @@ module Tenon
4
4
  params.require(:redirect).permit!
5
5
  end
6
6
 
7
+ def toggle_active
8
+ respond_to do |format|
9
+ if @redirect.toggle_active!
10
+ format.json { render json: @redirect.to_json }
11
+ format.html { flash[:notice] = 'redirect approved.' and redirect_to redirects_path }
12
+ else
13
+ format.json { render status: 500, nothing: true }
14
+ format.html { flash[:warning] = 'Error approving redirect.' and redirect_to redirects_path }
15
+ end
16
+ end
17
+ end
18
+
7
19
  private
8
20
 
9
21
  def search_args
@@ -10,4 +10,8 @@ class Tenon::Redirect < ActiveRecord::Base
10
10
  validates_presence_of :in, :out
11
11
  validates_uniqueness_of :in
12
12
 
13
+ def toggle_active!
14
+ self.active = self.active? ? false : true
15
+ save
16
+ end
13
17
  end
@@ -7,8 +7,8 @@ json.records do
7
7
  json.updater page.updater.present? ? page.updater.email : 'Unknown User'
8
8
  json.edit_path edit_page_path(page)
9
9
 
10
- if page.published? && route_exist?(page)
11
- json.view_link action_link("View on Site", main_app.polymorphic_path(page), "laptop")
10
+ if page.published?
11
+ json.view_link action_link("View on Site", page.path, "laptop")
12
12
  end
13
13
 
14
14
  json.subpage_link action_link("Create a Sub-Page", new_page_path(:parent_id => page.id), "plus")
@@ -1 +1,3 @@
1
1
  json.extract!(redirect, :id, :in, :out, :active, :edit_path, :edit_link, :delete_link)
2
+
3
+ json.active_link toggle_link(redirect, 'active', toggle_active_redirect_path(redirect), ['eye', 'Active'], ['eye-slash', 'Not Aactive'])
data/config/routes.rb CHANGED
@@ -43,6 +43,7 @@ Tenon::Engine.routes.draw do
43
43
 
44
44
  resources :redirects do
45
45
  post 'reorder', :on => :collection
46
+ get 'toggle_active', :on => :member
46
47
  end
47
48
 
48
49
  resources :users, :except => [:show] do
data/lib/tenon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tenon
2
- VERSION = '1.0.26'
2
+ VERSION = '1.0.27'
3
3
  end
@@ -7,4 +7,25 @@ describe Tenon::Redirect do
7
7
  Tenon::Redirect.active
8
8
  end
9
9
  end
10
+
11
+ describe '#toggle_active!' do
12
+ let(:redirect) { Tenon::Redirect.new(active: active) }
13
+ context 'when active is true' do
14
+ let(:active) { true }
15
+ it 'should set active to false and save the redirect' do
16
+ expect(redirect).to receive(:active=).with(false)
17
+ expect(redirect).to receive(:save)
18
+ redirect.toggle_active!
19
+ end
20
+ end
21
+
22
+ context 'when active is false' do
23
+ let(:active) { false }
24
+ it 'should set active to true and save the redirect' do
25
+ expect(redirect).to receive(:active=).with(true)
26
+ expect(redirect).to receive(:save)
27
+ redirect.toggle_active!
28
+ end
29
+ end
30
+ end
10
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.26
4
+ version: 1.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - factor[e] design initiative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-25 00:00:00.000000000 Z
11
+ date: 2014-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_errors
@@ -1470,7 +1470,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1470
1470
  version: '0'
1471
1471
  requirements: []
1472
1472
  rubyforge_project:
1473
- rubygems_version: 2.3.0
1473
+ rubygems_version: 2.2.2
1474
1474
  signing_key:
1475
1475
  specification_version: 4
1476
1476
  summary: A highly flexible mountable Rails CMS built for rapid application development.