tkh_illustrations 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d959cb0c0ee4e29518bf52a69affaa3fef6622a
4
- data.tar.gz: 21e0d9c7edb6121a0f0efba648b2d7ebc17f6f6f
3
+ metadata.gz: e44b135b46bfa957a2c279fd003d28def513d222
4
+ data.tar.gz: da85adf7580ad137502910c322cc3bbf9595801a
5
5
  SHA512:
6
- metadata.gz: 6d99b19201c36a0eb27e80e98a9948fbb124d96e85d79b5f72bdf6c02bb7bac494b1132b633355b48e5a901cf842817e8c10c96f1a53c675579d69419d8e800f
7
- data.tar.gz: c301088627b0426b2d41d14966f50a9e7b82586580bb5e0bd9d691a5b42eb7700248d2ffa52dad63921c78eb8e9b88f5a56d2876607866e9563ea4b5070f0d93
6
+ metadata.gz: d9187ec7a812f0c1db4767e33783139e199e4e536f8ca270ef256783d2e7c8d44ef5afac99d257a66d8f4469c8b3501f24646ba10e4b89c97a19ce773f491ffb
7
+ data.tar.gz: e1dc09d43b828e3ee9981118a756e6117ecdf190ce4b6160bfb907c7cbbfc261ce66009b21db826c7a32f0ddf6aa1492efb595593b0144c636750d053d409ce4
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
 
4
4
 
5
+
6
+ ## 0.9.2
7
+
8
+ * Implemented search of illustrations in admin panel
9
+
10
+
5
11
  ## 0.9.1
6
12
 
7
13
  * Various fixes and tweaks related to the upgrade
@@ -47,6 +47,16 @@ class IllustrationsController < ApplicationController
47
47
  redirect_to illustrations_url
48
48
  end
49
49
 
50
+ def search
51
+ illustration = Illustration.where('name = ?', illustration_params[:name]).first
52
+ if illustration
53
+ redirect_to illustration
54
+ else
55
+ flash[:warning] = "We could not find the illustration. Please make sure the name is accurate"
56
+ redirect_to illustrations_path
57
+ end
58
+ end
59
+
50
60
  private
51
61
 
52
62
  # Never trust parameters from the scary internet, only allow the white list through.
@@ -1,13 +1,9 @@
1
1
  <%= simple_form_for @illustration, :html => { multipart: true, class: 'form-horizontal' } do |f| %>
2
2
  <%= f.error_notification %>
3
3
 
4
- <div class="form-inputs">
5
- <%= f.input :image, label: t('activerecord.attributes.illustration.image') %>
6
- <%= f.input :name, label: t('activerecord.attributes.illustration.name') %>
7
- </div>
8
-
9
- <div class="form-actions">
4
+ <%= f.input :image, label: t('activerecord.attributes.illustration.image') %><br />
5
+ <%= f.input :name, label: t('activerecord.attributes.illustration.name') %><br />
10
6
  <%= f.button :submit, :class => 'btn btn-primary' %>
11
- <%= link_to t('illustrations.cancel'), illustrations_path, :class => 'btn' %>
12
- </div>
7
+ <%= link_to t('illustrations.cancel'), illustrations_path, :class => 'btn btn-default btn-xs' %>
8
+
13
9
  <% end %>
@@ -0,0 +1,20 @@
1
+ <%= form_for Illustration.new, url: search_illustrations_path, html: { id: 'search-form' }, method: :get do |f| %>
2
+ <%#= f.error_notification %>
3
+
4
+ <%= f.text_field :name,
5
+ label: false,
6
+ required: false,
7
+ placeholder: 'search by illustration name',
8
+ size: 35,
9
+ as: :string,
10
+ autofocus: 'autofocus',
11
+ id: 'illustration_name',
12
+ :wrapper_html => { :id => 'name' },
13
+ :autocomplete => 'off',
14
+ :data => { provide: 'typeahead',
15
+ items: 10,
16
+ source: Illustration.alphabetically.map(&:name).to_json }
17
+ %>
18
+ <%= f.submit 'find graphic', :class => 'btn btn-xs btn-primary' %>
19
+
20
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1><%= t('activerecord.models.illustrations') %></h1>
2
+ <%= render 'search_form' %>
3
+ <%= render 'tab_admin_menu' %>
@@ -1,6 +1,4 @@
1
- <h1><%= t('activerecord.models.illustrations') %></h1>
2
-
3
- <%= render 'tab_admin_menu' %>
1
+ <%= render 'section_header' %>
4
2
 
5
3
  <%= render 'form' %>
6
4
  <%= render 'shared/admin_sidebar' %>
@@ -1,16 +1,14 @@
1
- <h1><%= t('activerecord.models.illustrations') %></h1>
2
-
3
- <%= render 'tab_admin_menu' %>
1
+ <%= render 'section_header' %>
4
2
 
5
3
  <table class='table table-striped'>
6
4
  <thead>
7
- <tr>
5
+ <tr>
8
6
  <th><%= t('activerecord.models.illustration') %></th>
9
7
  <th><%= t('name_and_paths') %></th>
10
8
  <th><%= t('actions') %></th>
11
9
  </tr>
12
10
  </thead>
13
-
11
+
14
12
  <tbody>
15
13
  <% @illustrations.each do |illustration| %>
16
14
  <tr>
@@ -23,8 +21,8 @@
23
21
  <b>Large</b> path: <%= illustration.image.large %><br />
24
22
  <b>XL</b> path: <%= illustration.image.xl %>
25
23
  </td>
26
- <td><%= link_to t('edit'), edit_illustration_path(illustration), class: 'btn btn-mini' %>
27
- <%= link_to t('delete'), illustration, method: :delete, data: { confirm: t('are_you_sure') }, class: 'btn btn-mini btn-danger' %></td>
24
+ <td><%= link_to t('edit'), edit_illustration_path(illustration), class: 'btn btn-xs btn-default' %>
25
+ <%= link_to t('delete'), illustration, method: :delete, data: { confirm: t('are_you_sure') }, class: 'btn btn-xs btn-danger' %></td>
28
26
  </tr>
29
27
  <% end %>
30
28
  </tbody>
@@ -34,4 +32,4 @@
34
32
 
35
33
  <%= link_to t('illustrations.create.new'), new_illustration_path, class: 'btn btn-primary' %>
36
34
 
37
- <%= render 'shared/admin_sidebar' %>
35
+ <%= render 'shared/admin_sidebar' %>
@@ -1,6 +1,4 @@
1
- <h1><%= t('activerecord.models.illustrations') %></h1>
2
-
3
- <%= render 'tab_admin_menu' %>
1
+ <%= render 'section_header' %>
4
2
 
5
3
  <%= render 'form' %>
6
4
  <%= render 'shared/admin_sidebar' %>
@@ -1,9 +1,7 @@
1
1
  <% content_for :meta_title, @illustration.name %>
2
2
  <% content_for :meta_description, @illustration.name %>
3
3
 
4
- <h1><%= t('activerecord.models.illustrations') %></h1>
5
-
6
- <%= render 'tab_admin_menu' %>
4
+ <%= render 'section_header' %>
7
5
 
8
6
  <h3>Name: <%= @illustration.name %></h3>
9
7
  <p>
@@ -13,9 +11,7 @@
13
11
  <%= image_tag @illustration.image.large %><br /><%= @illustration.image.large %><br /><br />
14
12
  <%= image_tag @illustration.image.xl %><br /><%= @illustration.image.xl %>
15
13
  </p>
16
-
17
- <%= link_to t('edit'), edit_illustration_path(@illustration), :class => 'btn btn-primary' %>
18
- <%= link_to t('illustrations.all'), illustrations_path, class: 'btn' %>
19
- <%= link_to t('illustrations.upload_new'), new_illustration_path, class: 'btn' %>
14
+ <br />
15
+ <%= link_to t('edit'), edit_illustration_path(@illustration), :class => 'btn btn-primary' %><%= link_to t('illustrations.all'), illustrations_path, class: 'btn btn-default' %>
20
16
 
21
17
  <%= render 'shared/admin_sidebar' %>
data/config/routes.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  Rails.application.routes.draw do
2
2
  scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
3
- resources :illustrations
3
+ resources :illustrations do
4
+ collection do
5
+ get :search
6
+ end
7
+ end
4
8
  resources :headers
5
9
  end
6
- end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module TkhIllustrations
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_illustrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swami Atma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-25 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -146,6 +146,8 @@ files:
146
146
  - app/views/headers/new.html.erb
147
147
  - app/views/headers/show.html.erb
148
148
  - app/views/illustrations/_form.html.erb
149
+ - app/views/illustrations/_search_form.html.erb
150
+ - app/views/illustrations/_section_header.html.erb
149
151
  - app/views/illustrations/_tab_admin_menu.html.erb
150
152
  - app/views/illustrations/edit.html.erb
151
153
  - app/views/illustrations/index.html.erb