redde 0.3.0 → 0.3.1

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: aff8f56400af753e3a0920dd703951ed530ebee8
4
- data.tar.gz: d1c115a92042bbe4448447bdfcc2b8715b9364bd
3
+ metadata.gz: 5dfe0485b6b977a44124ef52c40206d970a8da28
4
+ data.tar.gz: d2e0b886c2906a310ee6e865f34fd5ee014709d8
5
5
  SHA512:
6
- metadata.gz: 4cc07ec6f8bf3ca41af2a05c1a8b6fa96fa34c032046a47576a23893d496ad31b8cd5738b8ec5395aea54e3bde7229e2fea065e15e4883abd750347b08cf0db3
7
- data.tar.gz: 654b4ae1a306f8e7b5c47f779500ebc5112b6c5361a5c9d9154776e57a2f6ab9405b7c2eee43cf496ac81adba8fb5ca32af4d53e2162b8ee6633ace2a3c77a31
6
+ metadata.gz: 0fca82ce871d89b082e6e38cb4a0bfc3e665639efc9d794b0c103d70a4bd483843e111b23d8a3a482bfb1e96b86325e38cfd5b189c76fc3edcb481fa8f65234a
7
+ data.tar.gz: 49ca40569bf78635f09bbc943451967531914ebce3fa3b6af93b1f09dd0db1dc94edab5918ac6dd53b25d51ec7b17b708a1ce3e50c8e2ba2ae2de9161059ca2d
@@ -1,5 +1,26 @@
1
1
  # coding: utf-8
2
2
  module Redde::AdminHelper
3
+
4
+ def page_header(item = nil, &block)
5
+ if block_given?
6
+ content_for(:page_header, content_tag(:div, capture(&block), class: 'page-header'))
7
+ elsif action_name == 'index'
8
+ content_for(:page_header, content_tag(:div, render('admin/redde/page_header'), class: 'page-header'))
9
+ else
10
+ content_for(:page_header, content_tag(:div, render('admin/redde/page_header_edit', item: instance_variable_get("@#{record}")), class: 'page-header'))
11
+ end
12
+ end
13
+
14
+ def redde_page(&block)
15
+ item = instance_variable_get("@#{record}")
16
+
17
+ capture do
18
+ concat page_header
19
+ concat redde_form_for([:admin, item]) { |f| capture(f, &block) }
20
+ concat photoable(item)
21
+ end
22
+ end
23
+
3
24
  def command_link(name, action, confirm = nil)
4
25
  options = { method: :put }
5
26
  options[:data] = { confirm: confirm } if confirm.present?
@@ -16,7 +37,7 @@ module Redde::AdminHelper
16
37
  end
17
38
 
18
39
  def photoable(parent)
19
- render('admin/redde_photos/photos', parent: parent)
40
+ render('admin/redde_photos/photos', parent: parent) if parent.class.reflect_on_association(:photos)
20
41
  end
21
42
 
22
43
  def tsingular(model)
@@ -18,7 +18,6 @@ module Redde::FormHelper
18
18
  concat f.redde_submits
19
19
  end
20
20
  end
21
-
22
21
  end
23
22
 
24
23
  def redde_fields_for(record_name, record_object = nil, options = {}, &block)
@@ -1,19 +1,9 @@
1
- - item = instance_variable_get("@#{record}")
2
- - content_for :page_header do
3
- .page-header__title
4
- - if item.new_record?
5
- Добавить #{taccusative(record)}
6
- - else
7
- Редактировать #{taccusative(record)}
8
- = link_to 'Назад', { action: :index }, class: 'btn page-header__btn'
9
-
10
- = photoable(item) if item.class.reflect_on_association(:photos)
11
-
12
- = redde_form_for [:admin, item] do |f|
1
+ = redde_page do |f|
13
2
  - form_column_names.each do |column|
14
3
  = f.redde_field column.to_sym
15
4
  - if column_names.include?('ancestry')
16
5
  = f.redde_select :parent_id, options_from_collection_for_select(f.object.class.all, :id, :title, f.object.parent_id), { include_blank: '- Выбрать -' }
6
+
17
7
  -# %div= render 'redditor/admin/page', { f: f } if @article.methods.include?(:page)
18
8
 
19
9
  -# проверить и написать правильное условие
@@ -1,4 +1,4 @@
1
- = render 'admin/redde/page_header'
1
+ = page_header
2
2
 
3
3
  - res_collection = instance_variable_get("@#{collection}")
4
4
  - if res_collection.any?
@@ -1,12 +1,10 @@
1
- = render 'admin/redde/page_header'
1
+ = page_header
2
2
 
3
3
  - res_collection = instance_variable_get("@#{collection}")
4
4
  - if res_collection.any?
5
5
  - cache [model_name.maximum(:updated_at).to_i] do
6
6
  %ol.sort-tree{ 'data-sort-tree' => '' }= render partial: 'tree_item', collection: res_collection, as: :item
7
7
 
8
- =# sort_tree sort_admin_categories_path, 2
9
-
10
8
  - else
11
9
  %h3
12
10
  Ни одной
@@ -1,10 +1,4 @@
1
- - content_for :page_header do
2
- %h1
3
- - if @manager.new_record?
4
- Добавить #{taccusative(:manager)}
5
- - else
6
- Редактировать #{taccusative(:manager)}
7
- %p= link_to 'Назад', [:admin, :managers]
1
+ = page_header
8
2
 
9
3
  = redde_form_for [:admin, @manager] do |f|
10
4
  = f.redde_text_field :email
@@ -1,6 +1,4 @@
1
- - content_for(:page_header) do
2
- %h1= tplural Manager
3
- %p= link_to "Добавить #{taccusative('manager')}", [:new, :admin, :manager]
1
+ = page_header
4
2
 
5
3
  - unless @managers.empty?
6
4
  %table.list
@@ -1,3 +1,2 @@
1
- - content_for(:page_header) do
2
- .page-header__title= tplural model_name
3
- = link_to "Добавить #{taccusative("#{record}")}", { action: :new }, class: 'btn page-header__btn'
1
+ .page-header__title= tplural model_name
2
+ = link_to "Добавить #{taccusative("#{record}")}", { action: :new }, class: 'btn page-header__btn'
@@ -0,0 +1,7 @@
1
+ .page-header__title
2
+ - if item.new_record?
3
+ Добавить
4
+ - else
5
+ Редактировать
6
+ = taccusative(record)
7
+ = link_to 'Назад', { action: :index }, class: 'btn page-header__btn'
@@ -1,5 +1,5 @@
1
- = content_for :page_header do
2
- %h1 Системные команды
1
+ = page_header do
2
+ .page-header__title Системные команды
3
3
 
4
4
  %h2 Сброс кэша
5
5
  %p
@@ -13,16 +13,11 @@
13
13
  .wrapper
14
14
  = render 'admin/redde/sidebar'
15
15
  .main
16
- .page-header
17
- = yield(:page_header)
16
+ = yield(:page_header)
18
17
  - if notice
19
18
  .flash-msg._notice= notice
20
19
  - if alert
21
20
  .flash-msg._alert= alert
22
- .main__page
23
- #filter
24
- = yield(:filter)
25
- - if yield(:page_sidebar).present?
26
- .main__sidebar.page-sidebar= yield(:page_sidebar)
27
- .main__content
28
- = yield
21
+ - if yield(:page_sidebar).present?
22
+ .main__sidebar.page-sidebar= yield(:page_sidebar)
23
+ .main__content= yield
data/lib/redde/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Redde
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Bovykin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-01-28 00:00:00.000000000 Z
12
+ date: 2016-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
@@ -567,6 +567,7 @@ files:
567
567
  - app/views/admin/redde/_header.html.haml
568
568
  - app/views/admin/redde/_main_menu.html.haml
569
569
  - app/views/admin/redde/_page_header.html.haml
570
+ - app/views/admin/redde/_page_header_edit.html.haml
570
571
  - app/views/admin/redde/_sidebar.html.haml
571
572
  - app/views/admin/redde/_validate.haml
572
573
  - app/views/admin/redde_photos/_photo.haml
@@ -621,7 +622,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
621
622
  version: '0'
622
623
  requirements: []
623
624
  rubyforge_project:
624
- rubygems_version: 2.5.1
625
+ rubygems_version: 2.4.5.1
625
626
  signing_key:
626
627
  specification_version: 4
627
628
  summary: Admin scaffold generator for redde projects