lolita 3.0.7 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/GUIDELINE +4 -0
  2. data/README.rdoc +50 -0
  3. data/VERSION +1 -1
  4. data/app/controllers/lolita/rest_controller.rb +27 -11
  5. data/app/helpers/components/lolita/configuration/list_component.rb +11 -0
  6. data/app/helpers/lolita_helper.rb +1 -1
  7. data/app/views/components/lolita/configuration/field/_display.html.erb +9 -0
  8. data/app/views/components/lolita/configuration/field/_label.html.erb +1 -0
  9. data/app/views/components/lolita/{field → configuration/field}/_object.html.erb +0 -0
  10. data/app/views/components/lolita/configuration/field/array/_display.html.erb +5 -0
  11. data/app/views/components/lolita/configuration/field/array/habtm/_display.html.erb +26 -0
  12. data/app/views/components/lolita/configuration/field/array/select/_display.html.erb +5 -0
  13. data/app/views/components/lolita/configuration/field/big_decimal/_display.html.erb +1 -0
  14. data/app/views/components/lolita/{field/_boolean.html.erb → configuration/field/boolean/_display.html.erb} +0 -0
  15. data/app/views/components/lolita/configuration/field/date/_display.html.erb +1 -0
  16. data/app/views/components/lolita/{field/_string.html.erb → configuration/field/float/_display.html.erb} +0 -0
  17. data/app/views/components/lolita/configuration/field/integer/_display.html.erb +1 -0
  18. data/app/views/components/lolita/configuration/field/string/_display.html.erb +5 -0
  19. data/app/views/components/lolita/{field/_disabled.html.erb → configuration/field/string/disabled/_display.html.erb} +0 -0
  20. data/app/views/components/lolita/{field/_password.html.erb → configuration/field/string/password/_display.html.erb} +0 -0
  21. data/app/views/components/lolita/configuration/field/string/text/_display.html.erb +34 -0
  22. data/app/views/components/lolita/configuration/field/time/_display.html.erb +1 -0
  23. data/app/views/components/lolita/{field_set → configuration/field_set}/_display.html.erb +1 -1
  24. data/app/views/components/lolita/configuration/list/_body.html.erb +5 -0
  25. data/app/views/components/lolita/{list → configuration/list}/_body_cell.html.erb +0 -0
  26. data/app/views/components/lolita/{list → configuration/list}/_checkbox_cell.html.erb +0 -0
  27. data/app/views/components/lolita/{list → configuration/list}/_checkbox_header.html.erb +0 -0
  28. data/app/views/components/lolita/configuration/list/_display.html.erb +12 -0
  29. data/app/views/components/lolita/configuration/list/_filter.html.erb +8 -0
  30. data/app/views/components/lolita/configuration/list/_header.html.erb +9 -0
  31. data/app/views/components/lolita/{list → configuration/list}/_header_cell.html.erb +0 -0
  32. data/app/views/components/lolita/{list → configuration/list}/_new_resource.html.erb +0 -0
  33. data/app/views/components/lolita/configuration/list/_paginator.html.erb +3 -0
  34. data/app/views/components/lolita/configuration/list/_row.html.erb +7 -0
  35. data/app/views/components/lolita/{list → configuration/list}/_title.html.erb +0 -0
  36. data/app/views/components/lolita/{list → configuration/list}/_tool_cell.html.erb +0 -0
  37. data/app/views/components/lolita/{list → configuration/list}/_tool_header.html.erb +0 -0
  38. data/app/views/components/lolita/configuration/tab/_display.html.erb +17 -0
  39. data/app/views/components/lolita/configuration/tab/_fields.html.erb +7 -0
  40. data/app/views/components/lolita/configuration/tab/content/_display.html.erb +1 -0
  41. data/app/views/components/lolita/configuration/tab/default/_display.html.erb +9 -0
  42. data/app/views/components/lolita/{tabs → configuration/tabs}/_display.html.erb +4 -3
  43. data/app/views/{lolita/layouts → layouts/lolita}/application.html.erb +0 -0
  44. data/app/views/{lolita/layouts → layouts/lolita}/application.html.erb_spec.rb +0 -0
  45. data/author +1 -1
  46. data/lib/lolita.rb +31 -12
  47. data/lib/lolita/adapter/active_record.rb +16 -5
  48. data/lib/lolita/adapter/mongoid.rb +2 -2
  49. data/lib/lolita/base_configuration.rb +44 -2
  50. data/lib/lolita/builder.rb +31 -14
  51. data/lib/lolita/configuration/column.rb +92 -86
  52. data/lib/lolita/configuration/columns.rb +65 -65
  53. data/lib/lolita/configuration/factory.rb +8 -8
  54. data/lib/lolita/configuration/field.rb +156 -100
  55. data/lib/lolita/configuration/field/array.rb +74 -0
  56. data/lib/lolita/configuration/field/big_decimal.rb +12 -0
  57. data/lib/lolita/configuration/field/boolean.rb +7 -5
  58. data/lib/lolita/configuration/field/date.rb +13 -0
  59. data/lib/lolita/configuration/field/integer.rb +7 -5
  60. data/lib/lolita/configuration/field/string.rb +8 -6
  61. data/lib/lolita/configuration/field/time.rb +13 -0
  62. data/lib/lolita/configuration/fields.rb +36 -0
  63. data/lib/lolita/configuration/filter.rb +63 -0
  64. data/lib/lolita/configuration/list.rb +101 -91
  65. data/lib/lolita/configuration/page.rb +1 -0
  66. data/lib/lolita/configuration/tab.rb +137 -131
  67. data/lib/lolita/configuration/tab/content.rb +14 -12
  68. data/lib/lolita/configuration/tab/default.rb +15 -13
  69. data/lib/lolita/configuration/tabs.rb +2 -2
  70. data/lib/lolita/controllers/component_helpers.rb +26 -14
  71. data/lib/lolita/controllers/internal_helpers.rb +14 -0
  72. data/lib/lolita/controllers/url_helpers.rb +47 -10
  73. data/lib/lolita/dbi/base.rb +50 -50
  74. data/lib/lolita/errors.rb +2 -2
  75. data/lib/lolita/hooks.rb +298 -0
  76. data/lib/lolita/hooks/named_hook.rb +122 -0
  77. data/lib/lolita/lazy_loader.rb +46 -46
  78. data/lib/lolita/mapping.rb +3 -2
  79. data/lib/lolita/navigation.rb +48 -0
  80. data/lib/lolita/observed_array.rb +7 -0
  81. data/lib/lolita/rails/routes.rb +29 -3
  82. data/lolita.gemspec +65 -48
  83. data/public/javascripts/lolita/tab.js +5 -0
  84. data/public/javascripts/rails.js +137 -137
  85. data/public/stylesheets/lolita/style.css +3 -1
  86. data/spec/builder_spec.rb +42 -0
  87. data/spec/configuration/field_spec.rb +29 -18
  88. data/spec/configuration/filter_spec.rb +60 -0
  89. data/spec/configuration/tab_spec.rb +28 -20
  90. data/spec/configuration/tabs_spec.rb +8 -4
  91. data/spec/controllers/lolita_rest_spec.rb +15 -0
  92. data/spec/hooks_spec.rb +191 -0
  93. data/spec/lolita_spec.rb +6 -4
  94. data/spec/navigation/tree_spec.rb +59 -0
  95. data/spec/rails_app/app/mongoid/post.rb +2 -0
  96. data/spec/rails_app/app/views/components/lolita/{list → configuration/list}/_body_cell.html.erb +0 -0
  97. data/spec/rails_app/config/application.rb +1 -0
  98. data/spec/rails_app/lib/lolita/configuration/field/my_custom_collection.rb +14 -0
  99. data/spec/simple_spec_helper.rb +1 -0
  100. data/spec/spec_helper.rb +1 -2
  101. metadata +66 -49
  102. data/README.md +0 -5
  103. data/app/helpers/components/lolita/list_component.rb +0 -9
  104. data/app/views/components/lolita/field/_collection.html.erb +0 -5
  105. data/app/views/components/lolita/field/_date.html.erb +0 -1
  106. data/app/views/components/lolita/field/_datetime.html.erb +0 -1
  107. data/app/views/components/lolita/field/_display.html.erb +0 -6
  108. data/app/views/components/lolita/field/_integer.html.erb +0 -1
  109. data/app/views/components/lolita/field/_label.html.erb +0 -1
  110. data/app/views/components/lolita/field/_select.html.erb +0 -1
  111. data/app/views/components/lolita/field/_text.html.erb +0 -27
  112. data/app/views/components/lolita/list/_body.html.erb +0 -5
  113. data/app/views/components/lolita/list/_display.html.erb +0 -11
  114. data/app/views/components/lolita/list/_header.html.erb +0 -9
  115. data/app/views/components/lolita/list/_paginator.html.erb +0 -4
  116. data/app/views/components/lolita/list/_row.html.erb +0 -7
  117. data/app/views/components/lolita/tab/_content.html.erb +0 -1
  118. data/app/views/components/lolita/tab/_default.html.erb +0 -11
  119. data/app/views/components/lolita/tab/_display.html.erb +0 -7
  120. data/app/views/components/lolita/tab/_fields.html.erb +0 -7
  121. data/lib/lolita/configuration/field/collection.rb +0 -71
  122. data/lib/lolita/configuration/field/datetime.rb +0 -10
  123. data/lib/lolita/configuration/field/disabled.rb +0 -10
  124. data/lib/lolita/configuration/field/password.rb +0 -10
  125. data/lib/lolita/configuration/field/text.rb +0 -10
  126. data/lib/lolita/hooks/base.rb +0 -58
  127. data/lib/lolita/hooks/component.rb +0 -15
  128. data/lib/lolita/hooks/hooks.rb +0 -15
data/GUIDELINE CHANGED
@@ -1,3 +1,7 @@
1
+ =Lolita developer guidline
2
+
3
+ This file is meant for developers only.
4
+
1
5
  # Creating GEM for Lolita
2
6
 
3
7
  When creating GEM, that include new module in one or more of lolita modules, use
@@ -0,0 +1,50 @@
1
+ =Lolita
2
+
3
+ Content management system that works with rails.
4
+ ==Demo
5
+ See the demo page at Demo[http://lolita-demo.ithouse.lv]
6
+
7
+ ==Installation
8
+
9
+ First install Lolita gem
10
+ sudo gem install lolita
11
+
12
+ Then go to your rails project and
13
+ rails g lolita:install
14
+
15
+ That will create initializer and copy all assets.
16
+ Also it will call <em>install</em> on all added modules to lolita.
17
+ So if you in Gemfile have following
18
+ gem "lolita"
19
+ gem "lolita-file-upload"
20
+ It will also call <i>lolita_file_upload:install</i>.
21
+ ==Usage
22
+
23
+ To make your model use Lolita do like this
24
+ class Post < ActiveRecord::Base
25
+ include Lolita::Configuration
26
+ lolita
27
+ end
28
+ Then in routes.rb file make resources accessable for lolita with
29
+ lolita_for :posts
30
+ This will make routes like
31
+ /lolita/posts
32
+ /lolita/posts/1/edit
33
+ /lolita/posts/new
34
+ ===Add authorization to Lolita
35
+
36
+ Easiest way to add authentication is with Devise. First install Devise as gem, than add to it your project.
37
+ Make Devise model, lets say, User. After that add these lines in <i>/config/initializers/lolita.rb</i>
38
+ config.user_classes << User
39
+ config.authentication = :authenticate_user!
40
+ This will make before each Lolita requests call before filter, that than will call <em>authenticate_user!</em>
41
+ that is Devise method for authenticating user. Without it Lolita will be acessable for everyone.
42
+ You can also add any other authentication method like
43
+ config.authentication = :authenticate_admin
44
+ And than put this method for common use in <em>ApplicationController</em> or in some other place that is accessable
45
+ to all controllers.
46
+ ===Using newer version of Lolita
47
+
48
+ If you decide to use some newer version, you most likely should copy new assets to your project.
49
+ This can be done with
50
+ rails g lolita:assets
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.7
1
+ 3.1.0
@@ -3,7 +3,7 @@ class Lolita::RestController < ApplicationController
3
3
  include Lolita::Controllers::InternalHelpers
4
4
 
5
5
  before_filter :authenticate_lolita_user!
6
- layout "lolita/layouts/application"
6
+ layout "lolita/application"
7
7
 
8
8
  def new
9
9
  build_resource
@@ -31,12 +31,14 @@ class Lolita::RestController < ApplicationController
31
31
  def destroy
32
32
  get_resource
33
33
  if self.resource && self.resource.destroy
34
- to_list
34
+ flash.now[:notice] = I18n.t "lolita.shared.destroy_notice"
35
+ else
36
+ flash.now[:alert] = I18n.t "lolita.shared.destroy_alert"
35
37
  end
38
+ redirect_to :action=>"index"
36
39
  end
37
40
 
38
41
  def index
39
- page=resource_class.lolita.list.paginate(params[:page])
40
42
  respond_to do |format|
41
43
  format.html do
42
44
  build_response_for(:list,:page=>page)
@@ -50,6 +52,11 @@ class Lolita::RestController < ApplicationController
50
52
  private
51
53
 
52
54
  def show_form
55
+ #TODO Valdis: ja es extendoju rest_controller un gribu pārdefinēt edit actionu, man vajag lai
56
+ # varu norādīt citu šablonu, piemēram, manā gadījumā ir services_controller un jamais meklē
57
+ # "services/form", bet es gribu izmantot to pašu "lolita/rest/form"
58
+ # tagad man viss šitais jāpārkopē uz projektu
59
+
53
60
  build_response_for(:tabs)
54
61
  if request.xhr?
55
62
  render :form, :layout => false
@@ -59,19 +66,28 @@ class Lolita::RestController < ApplicationController
59
66
  end
60
67
 
61
68
  def save_and_redirect
62
- if self.resource.save
63
- flash.now[:notice] = I18n.t "lolita.shared.save_notice"
64
- show_form
65
- else
66
- flash.now[:alert] = I18n.t "lolita.shared.save_alert"
67
- show_form #to_list
68
- end
69
+ respond_to do |format|
70
+ format.html do
71
+ if self.resource.save
72
+ flash.now[:notice] = I18n.t "lolita.shared.save_notice"
73
+ else
74
+ flash.now[:alert] = I18n.t "lolita.shared.save_alert"
75
+ end
76
+ show_form
77
+ end
78
+ format.json do
79
+ render :status => self.resource.save ? 200 : 400, :json => self.resource
80
+ end
81
+ end
69
82
  end
70
83
 
71
84
  def to_list
72
- page=resource_class.lolita.list.paginate(params[:page])
73
85
  builder=build_response_for(:list,:page=>page)
74
86
  render :index
75
87
  #render_component *builder
76
88
  end
89
+
90
+ def page
91
+ resource_class.lolita.list.paginate(params[:page])
92
+ end
77
93
  end
@@ -0,0 +1,11 @@
1
+ module Components
2
+ module Lolita
3
+ module Configuration
4
+ module ListComponent
5
+ def sort_options
6
+ params[:sort]
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -4,7 +4,7 @@ module LolitaHelper
4
4
  # This is helpful because different positionings within it exist depending on action
5
5
  def content_classes
6
6
  classes = []
7
- if params[:action] == "edit"
7
+ if params[:action] == "edit" || params[:action] == "new"
8
8
  classes << "with-secondary"
9
9
  end
10
10
  classes.join(" ")
@@ -0,0 +1,9 @@
1
+ <div class="field" id="field_<%=field.__id__%>">
2
+ <%= render_component :"lolita/configuration/field", :label, :field=>field %>
3
+ <div class="field-value" id="field_<%=field.__id__%>_value">
4
+ <%= render_component *field.build %>
5
+ </div>
6
+ <% unless resource.errors[field.name.to_s.gsub(/_id$/,"").to_sym].empty? %>
7
+ <p class="inline-errors"><%= raw resource.errors[field.name.to_s.gsub(/_id$/,"").to_sym].join("<br>") %></p>
8
+ <% end %>
9
+ </div>
@@ -0,0 +1 @@
1
+ <%= label resource_name,(field.title || field.name), :id=>"field_#{field.__id__}_label" %>
@@ -0,0 +1,5 @@
1
+ <% if field.association_type == :one %>
2
+ <%= render_component :"lolita/configuration/field/array/select", :display, :field=>field %>
3
+ <% else %>
4
+ <%= render_component :"lolita/configuration/field/array/habtm", :display, :field=>field %>
5
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <% options = field.association_values.respond_to?(:call) ? field.association_values.call(self) : field.association_values %>
2
+ <% values = self.instance_variable_get("@#{resource_name}").send("#{field.name}") %>
3
+ <% subject_habtm_fieldname = "#{field.name.to_s.singularize}_ids" %>
4
+ <% values.each{|value|%>
5
+ <%
6
+ option_tags = options.collect{|option|
7
+ option_tag_attributes = {:value=>option[1]}
8
+ option_tag_attributes[:selected] = "selected" if option[1] == value.id
9
+ content_tag :option, option[0], option_tag_attributes
10
+ }.join("").html_safe
11
+ %>
12
+ <div style="height:30px;">
13
+ <%= select_tag "#{resource_name}[#{subject_habtm_fieldname}][]", option_tags ,{:include_blank=>true} %>
14
+ </div>
15
+ <% } %>
16
+ <% empty_fields = (values.size < 5) ? (5 - values.size) : 0 %>
17
+ <%
18
+ option_tags = options.collect{|option|
19
+ content_tag :option, option[0], {:value=>option[1]}
20
+ }.join("").html_safe
21
+ %>
22
+ <% empty_fields.times{ %>
23
+ <div style="height:30px;">
24
+ <%= select_tag "#{resource_name}[#{subject_habtm_fieldname}][]", option_tags ,{:include_blank=>true} %>
25
+ </div>
26
+ <% } %>
@@ -0,0 +1,5 @@
1
+ <%= select resource_name,
2
+ field.name,
3
+ (field.association_values.respond_to?(:call) ? field.association_values.call(self) : field.association_values),
4
+ {:include_blank => field.include_blank},
5
+ field.html_options || {} %>
@@ -0,0 +1 @@
1
+ <%= render_component :"lolita/configuration/field/string", :display, :field=>field %>
@@ -0,0 +1 @@
1
+ <%= date_select resource_name, field.name %>
@@ -0,0 +1 @@
1
+ <%= render_component :"lolita/configuration/field/string", :display,:field=>field %>
@@ -0,0 +1,5 @@
1
+ <% if field.options[:native_type] == "text" %>
2
+ <%= render_component :"lolita/configuration/field/string/text", :display, :field=>field %>
3
+ <% else %>
4
+ <%= text_field resource_name, field.name %>
5
+ <% end %>
@@ -0,0 +1,34 @@
1
+ <% if @textarea_component_include_tinymce_once.nil? %>
2
+ <% content_for :script do %>
3
+ <%= javascript_include_tag "tinymce/jquery.tinymce" %>
4
+ <script type="text/javascript">
5
+ function load_tinymce(){
6
+ $("textarea[data-simple!=true]").tinymce({
7
+ script_url: "/javascripts/tinymce/tiny_mce.js",
8
+ theme: "advanced",
9
+ skin: "cirkuit",
10
+ mode: "textareas",
11
+ theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,formatselect,|,link,unlink,image,code",
12
+ theme_advanced_buttons2 : "",
13
+ theme_advanced_buttons3 : "",
14
+ theme_advanced_toolbar_location: "top",
15
+ theme_advanced_toolbar_align: "left",
16
+ // theme_advanced_statusbar_location : "bottom",
17
+ theme_advanced_resizing: true
18
+ });
19
+ }
20
+ </script>
21
+ <% end %>
22
+ <% end %>
23
+
24
+ <%= text_area resource_name, field.name, :rows=>(field.rows || 20), :"data-simple"=>field.simple %>
25
+ <% if @textarea_component_include_tinymce_once.nil? %>
26
+ <script type="text/javascript">
27
+ $(document).ready(
28
+ $(function(){
29
+ load_tinymce();
30
+ })
31
+ )
32
+ </script>
33
+ <% end %>
34
+ <% @textarea_component_include_tinymce_once = "done" %>
@@ -0,0 +1 @@
1
+ <%= datetime_select resource_name, field.name %>
@@ -1,5 +1,5 @@
1
1
  <div class="fieldset" id="<%=field_set.name%>">
2
2
  <% fields.each do |field| %>
3
- <%= render_component :"lolita/field", :display, :field=>field %>
3
+ <%= render_component *field.builder %>
4
4
  <% end %>
5
5
  </div>
@@ -0,0 +1,5 @@
1
+ <tbody>
2
+ <% page.each_with_index do |record,index| %>
3
+ <%= render_component :"lolita/configuration/list", :row, :columns=>columns,:record=>record,:index=>index %>
4
+ <% end %>
5
+ </tbody>
@@ -0,0 +1,12 @@
1
+ <div class="box">
2
+ <%= render_component :"lolita/configuration/list", :title %>
3
+ <%= render_component :"lolita/configuration/list", :new_resource%>
4
+ <%= render_component :"lolita/configuration/list", :filter, :list => list %>
5
+ <div class="list">
6
+ <table>
7
+ <%= render_component :"lolita/configuration/list", :header, :columns=>list.columns %>
8
+ <%= render_component :"lolita/configuration/list", :body, :page=>page,:columns=>list.columns %>
9
+ </table>
10
+ </div>
11
+ <%= render_component :"lolita/configuration/list", :paginator,:page=>page, :columns=>list.columns %>
12
+ </div>
@@ -0,0 +1,8 @@
1
+ <% if list.filter? -%>
2
+ <form action="" action="get" class="filter">
3
+ <% list.filter.fields.each do |field| %>
4
+ <%= render_component *field.build %>
5
+ <% end %>
6
+ <button type="submit">Apply</button>
7
+ </form>
8
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ <thead>
2
+ <tr>
3
+ <%= render_component :"lolita/configuration/list",:checkbox_header %>
4
+ <% columns.each do |column| %>
5
+ <%= render_component :"lolita/configuration/list", :header_cell, :column=>column %>
6
+ <% end %>
7
+ <%= render_component :"lolita/configuration/list",:tool_header %>
8
+ </tr>
9
+ </thead>
@@ -0,0 +1,3 @@
1
+ <div class="paginator">
2
+ <%= will_paginate page %>
3
+ </div>
@@ -0,0 +1,7 @@
1
+ <tr class="<%= @class_name %>">
2
+ <%= render_component :"lolita/configuration/list", :checkbox_cell, :record=>record %>
3
+ <% columns.each do |column| %>
4
+ <%= render_component :"lolita/configuration/list",:body_cell, :value=>column.with_format(record.send(column.name.to_sym)) %>
5
+ <% end %>
6
+ <%= render_component :"lolita/configuration/list", :tool_cell,:record=>record %>
7
+ </tr>
@@ -0,0 +1,17 @@
1
+ <div class="tab box" id="tab_<%=tab.__id__%>">
2
+ <div class="tab-title boxtitle black" data-closed="false">
3
+ <h1><%= tab.title %></h1>
4
+ <div class="arrow"></div> <%# FIXME more DRY solution is needed for .arrow within .boxtitle, maybe box helper %>
5
+ </div>
6
+ <% if resource.errors.any? %>
7
+ <p class="errorExplanation" id="errorExplanation">
8
+ <%= raw resource.errors.keys.collect{|k|
9
+ if error_tab = tab.fields.by_name(k)
10
+ "#{error_tab.title.humanize.capitalize}: "+
11
+ "#{resource.errors[k].collect{|m| m.capitalize}.join(" and ")}"
12
+ end
13
+ }.compact.join("<br>") %>
14
+ </p>
15
+ <% end %>
16
+ <%= render_component *tab.build %>
17
+ </div>
@@ -0,0 +1,7 @@
1
+ <% tab.fields_with_field_set do |fields_or_field,field_set| %>
2
+ <% if field_set %>
3
+ <%= render_component :"lolita/configuration/field_set", :display, :fields=>fields_or_field,:field_set=>field_set %>
4
+ <% else %>
5
+ <%= render_component :"lolita/configuration/field", :display,:field=>fields_or_field %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render_component :"lolita/configuration/tab/default", :display, :tab=>tab %>
@@ -0,0 +1,9 @@
1
+ <% #
2
+ # FIXME: move to /tab_types/
3
+ #
4
+ %>
5
+ <%= form_tag "#", :id=>"tab-form-#{tab.__id__}" do |form| %>
6
+ <div class="tab-content">
7
+ <%= render_component :"lolita/configuration/tab", :fields, :tab=>tab %>
8
+ </div>
9
+ <% end %>
@@ -1,11 +1,12 @@
1
- <%= render_component :"lolita/shared", :flash, :flash => flash %> <%# FIXME does it really need passed flash as local var? %>
1
+ <%= render_component :"lolita/shared", :flash, :flash=>flash %>
2
2
  <%= render_component :"lolita/shared", :right_sidebar %>
3
3
 
4
- <%#= resource.errors.full_messages if resource.errors.any? %>
4
+ <% #error messages here not necessary, printing full messages moved to :"lolita/tab" component %>
5
+ <% # = raw resource.errors.full_messages.join("<br>") if resource.errors.any? %>
5
6
 
6
7
  <% #mode container div with all data-* method to helper and change to block method %>
7
8
  <div id="tabs-<%= resource_name %>" class="tabs" data-method="<%=resource.new_record? ? "POST" : "PUT" %>" data-tabs-url="<%=resource.new_record? ? lolita_resources_path : lolita_resource_path(:id=>resource.id)%>">
8
9
  <% tabs.each do |tab| %>
9
- <%= render_component :"lolita/tab", :display, :tab=>tab %>
10
+ <%= render_component :"lolita/configuration/tab", :display, :tab=>tab %>
10
11
  <% end %>
11
12
  </div>
data/author CHANGED
@@ -1 +1 @@
1
- This software is developed by IT House (Latvia) and Artūrs Meisters
1
+ This software is developed by IT House (Latvia) and Artūrs Meisters
@@ -19,6 +19,7 @@ module Lolita
19
19
  autoload(:ObservedArray,'lolita/observed_array')
20
20
  autoload(:Builder,'lolita/builder')
21
21
  autoload(:BaseConfiguration,'lolita/base_configuration')
22
+
22
23
  module Adapter
23
24
  autoload :AbstractAdapter, 'lolita/adapter/abstract_adapter'
24
25
  autoload :ActiveRecord, 'lolita/adapter/active_record'
@@ -29,32 +30,45 @@ module Lolita
29
30
  autoload :Base, 'lolita/dbi/base'
30
31
  end
31
32
 
33
+ autoload :Hooks, "lolita/hooks"
32
34
  module Hooks
33
- require 'lolita/hooks/hooks'
34
- include Lolita::Hooks::Hooks
35
- autoload :Base, 'lolita/hooks/base'
36
- autoload :Component, 'lolita/hooks/component'
35
+ autoload :NamedHook, "lolita/hooks/named_hook"
37
36
  end
37
+
38
38
 
39
39
  module Configuration
40
40
  autoload :Factory, 'lolita/configuration/factory'
41
41
  autoload :Base, 'lolita/configuration/base'
42
42
  autoload :Column, 'lolita/configuration/column'
43
43
  autoload :Columns, 'lolita/configuration/columns'
44
- autoload :Field, 'lolita/configuration/field'
44
+ autoload :Fields, 'lolita/configuration/fields'
45
45
  autoload :FieldSet, 'lolita/configuration/field_set'
46
46
  autoload :List, 'lolita/configuration/list'
47
47
  autoload :Page, 'lolita/configuration/page'
48
- autoload :Tab, 'lolita/configuration/tab'
49
48
  autoload :Tabs, 'lolita/configuration/tabs'
50
-
51
- ["tab","field"].each do |type|
52
- Dir["#{File.dirname(__FILE__)}/lolita/configuration/#{type}/**/*.*"].each do |path|
53
- base_name=File.basename(path,".rb")
54
- autoload :"#{base_name.capitalize}#{type.humanize}", "lolita/configuration/#{type}/#{base_name}"
49
+ autoload :Filter, 'lolita/configuration/filter'
50
+
51
+ module Field
52
+ extend Lolita::Configuration::Factory
53
+ autoload :Base, 'lolita/configuration/field'
54
+ ["field"].each do |type|
55
+ Dir["#{File.dirname(__FILE__)}/lolita/configuration/#{type}/**/*.*"].each do |path|
56
+ base_name=File.basename(path,".rb")
57
+ autoload :"#{base_name.camelize}", "lolita/configuration/#{type}/#{base_name}"
58
+ end
59
+ end
60
+ end
61
+
62
+ module Tab
63
+ extend Lolita::Configuration::Factory
64
+ autoload :Base, 'lolita/configuration/tab'
65
+ ["tab"].each do |type|
66
+ Dir["#{File.dirname(__FILE__)}/lolita/configuration/#{type}/**/*.*"].each do |path|
67
+ base_name=File.basename(path,".rb")
68
+ autoload :"#{base_name.camelize}", "lolita/configuration/#{type}/#{base_name}"
69
+ end
55
70
  end
56
71
  end
57
-
58
72
 
59
73
  def self.included(base)
60
74
  base.class_eval do
@@ -91,6 +105,11 @@ module Lolita
91
105
  autoload :ViewUserHelpers, 'lolita/controllers/view_user_helpers'
92
106
  end
93
107
 
108
+ autoload(:Navigation,"lolita/navigation")
109
+ module Navigation
110
+ autoload :Tree, "lolita/navigation"
111
+ autoload :Branch, "lolita/navigation"
112
+ end
94
113
 
95
114
  @@scopes={}
96
115