fesplugas-typus 0.9.8 → 0.9.9
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.
- data/VERSION +1 -1
- data/app/controllers/admin/master_controller.rb +4 -1
- data/app/helpers/admin/form_helper.rb +6 -6
- data/app/helpers/admin/master_helper.rb +1 -1
- data/app/helpers/admin/sidebar_helper.rb +9 -9
- data/app/helpers/admin/table_helper.rb +1 -1
- data/app/helpers/typus_helper.rb +14 -10
- data/app/models/typus_mailer.rb +1 -1
- data/app/views/admin/resources/edit.html.erb +3 -4
- data/app/views/admin/resources/index.html.erb +1 -2
- data/app/views/admin/resources/new.html.erb +3 -4
- data/app/views/admin/resources/show.html.erb +2 -3
- data/app/views/typus/dashboard.html.erb +1 -1
- data/app/views/typus/recover_password.html.erb +2 -2
- data/app/views/typus/reset_password.html.erb +3 -3
- data/app/views/typus/sign_in.html.erb +3 -3
- data/app/views/typus/sign_up.html.erb +2 -2
- data/generators/typus/templates/public/stylesheets/admin/screen.css +12 -6
- data/lib/typus/generator.rb +1 -1
- data/lib/typus/object.rb +3 -3
- data/test/functional/admin/comments_controller_test.rb +3 -11
- data/test/functional/typus_controller_test.rb +2 -2
- data/test/helper.rb +0 -6
- data/test/helpers/typus_helper_test.rb +13 -4
- data/typus.gemspec +2 -2
- metadata +2 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.9
|
|
@@ -116,7 +116,10 @@ class Admin::MasterController < ApplicationController
|
|
|
116
116
|
|
|
117
117
|
respond_to do |format|
|
|
118
118
|
format.html { select_template :show }
|
|
119
|
-
format.xml
|
|
119
|
+
format.xml do
|
|
120
|
+
fields = @resource[:class].typus_fields_for(:xml).collect { |i| i.first }
|
|
121
|
+
render :xml => @item.to_xml(:only => fields)
|
|
122
|
+
end
|
|
120
123
|
end
|
|
121
124
|
|
|
122
125
|
end
|
|
@@ -57,7 +57,7 @@ module Admin::FormHelper
|
|
|
57
57
|
else
|
|
58
58
|
html << <<-HTML
|
|
59
59
|
<li><label for="item_#{attribute}">#{_(related_fk.humanize)}
|
|
60
|
-
<small>#{link_to _(
|
|
60
|
+
<small>#{link_to _("Add"), { :controller => "admin/#{related.class_name.tableize}", :action => 'new', :back_to => back_to, :selected => related_fk }, :confirm => message.join("\n\n") if @current_user.can_perform?(related, 'create')}</small>
|
|
61
61
|
</label>
|
|
62
62
|
#{select :item, related_fk, related.find(:all, :order => related.typus_order_by).collect { |p| [p.typus_name, p.id] }, { :include_blank => true }, { :disabled => attribute_disabled?(attribute) } }</li>
|
|
63
63
|
HTML
|
|
@@ -71,7 +71,7 @@ module Admin::FormHelper
|
|
|
71
71
|
attribute_name = attribute.gsub(/\?$/,'')
|
|
72
72
|
<<-HTML
|
|
73
73
|
<li><label for="item_#{attribute_name}">#{@resource[:class].human_attribute_name(attribute)}</label>
|
|
74
|
-
#{check_box :item, attribute_name} #{_(
|
|
74
|
+
#{check_box :item, attribute_name} #{_("Checked if active")}</li>
|
|
75
75
|
HTML
|
|
76
76
|
end
|
|
77
77
|
|
|
@@ -225,8 +225,8 @@ module Admin::FormHelper
|
|
|
225
225
|
<a name="#{field}"></a>
|
|
226
226
|
<div class="box_relationships">
|
|
227
227
|
<h2>
|
|
228
|
-
#{link_to model_to_relate.human_name.pluralize, { :controller => "admin/#{model_to_relate_as_resource}", foreign_key => @item.id }, :title => _(
|
|
229
|
-
<small>#{link_to _(
|
|
228
|
+
#{link_to model_to_relate.human_name.pluralize, { :controller => "admin/#{model_to_relate_as_resource}", foreign_key => @item.id }, :title => _("{{model}} filtered by {{filtered_by}}", :model => model_to_relate.human_name.pluralize, :filtered_by => @item.typus_name)}
|
|
229
|
+
<small>#{link_to _("Add new"), link_options if @current_user.can_perform?(model_to_relate, 'create')}</small>
|
|
230
230
|
</h2>
|
|
231
231
|
HTML
|
|
232
232
|
|
|
@@ -269,7 +269,7 @@ module Admin::FormHelper
|
|
|
269
269
|
<div class="box_relationships">
|
|
270
270
|
<h2>
|
|
271
271
|
#{link_to model_to_relate.human_name.pluralize, :controller => "admin/#{model_to_relate_as_resource}"}
|
|
272
|
-
<small>#{link_to _(
|
|
272
|
+
<small>#{link_to _("Add new"), :controller => field, :action => 'new', :back_to => @back_to, :resource => @resource[:self], :resource_id => @item.id if @current_user.can_perform?(model_to_relate, 'create')}</small>
|
|
273
273
|
</h2>
|
|
274
274
|
HTML
|
|
275
275
|
items_to_relate = (model_to_relate.find(:all) - @item.send(field))
|
|
@@ -277,7 +277,7 @@ module Admin::FormHelper
|
|
|
277
277
|
html << <<-HTML
|
|
278
278
|
#{form_tag :action => 'relate', :id => @item.id}
|
|
279
279
|
#{hidden_field :related, :model, :value => model_to_relate}
|
|
280
|
-
<p>#{ select :related, :id, items_to_relate.collect { |f| [f.typus_name, f.id] }.sort_by { |e| e.first } } #{submit_tag _(
|
|
280
|
+
<p>#{ select :related, :id, items_to_relate.collect { |f| [f.typus_name, f.id] }.sort_by { |e| e.first } } #{submit_tag _("Add"), :class => 'button'}</p>
|
|
281
281
|
</form>
|
|
282
282
|
HTML
|
|
283
283
|
end
|
|
@@ -24,14 +24,14 @@ module Admin::SidebarHelper
|
|
|
24
24
|
case params[:action]
|
|
25
25
|
when 'index', 'edit', 'show', 'update'
|
|
26
26
|
if @current_user.can_perform?(@resource[:class], 'create')
|
|
27
|
-
items << (link_to _(
|
|
27
|
+
items << (link_to _("Add entry"), :action => 'new')
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
case params[:action]
|
|
32
32
|
when 'show'
|
|
33
33
|
if @current_user.can_perform?(@resource[:class], 'update')
|
|
34
|
-
items << (link_to _(
|
|
34
|
+
items << (link_to _("Edit entry"), :action => 'edit', :id => @item.id)
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -43,7 +43,7 @@ module Admin::SidebarHelper
|
|
|
43
43
|
|
|
44
44
|
case params[:action]
|
|
45
45
|
when 'new', 'create', 'edit', 'show', 'update'
|
|
46
|
-
items << (link_to _(
|
|
46
|
+
items << (link_to _("Back to list"), :action => 'index')
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
return items
|
|
@@ -85,8 +85,8 @@ module Admin::SidebarHelper
|
|
|
85
85
|
def previous_and_next
|
|
86
86
|
return [] unless %w( edit show update ).include?(params[:action])
|
|
87
87
|
returning(Array.new) do |items|
|
|
88
|
-
items << (link_to _(
|
|
89
|
-
items << (link_to _(
|
|
88
|
+
items << (link_to _("Next"), params.merge(:id => @next.id)) if @next
|
|
89
|
+
items << (link_to _("Previous"), params.merge(:id => @previous.id)) if @previous
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
@@ -103,12 +103,12 @@ module Admin::SidebarHelper
|
|
|
103
103
|
hidden_params = search_params.map { |key, value| hidden_field_tag(key, value) }
|
|
104
104
|
|
|
105
105
|
<<-HTML
|
|
106
|
-
<h2>#{_(
|
|
106
|
+
<h2>#{_("Search")}</h2>
|
|
107
107
|
<form action="" method="get">
|
|
108
108
|
<p><input id="search" name="search" type="text" value="#{params[:search]}"/></p>
|
|
109
109
|
#{hidden_params.sort.join("\n")}
|
|
110
110
|
</form>
|
|
111
|
-
<p class="tip">#{_(
|
|
111
|
+
<p class="tip">#{_("Search by")} #{search_by.downcase}.</p>
|
|
112
112
|
HTML
|
|
113
113
|
|
|
114
114
|
end
|
|
@@ -130,7 +130,7 @@ module Admin::SidebarHelper
|
|
|
130
130
|
when :has_and_belongs_to_many:
|
|
131
131
|
html << relationship_filter(current_request, key, true)
|
|
132
132
|
else
|
|
133
|
-
html << "<p>#{_(
|
|
133
|
+
html << "<p>#{_("Unknown")}</p>"
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
end
|
|
@@ -171,7 +171,7 @@ function surfto_#{model_pluralized}(form) {
|
|
|
171
171
|
<!-- /Embedded JS -->
|
|
172
172
|
<p><form class="form" action="#">
|
|
173
173
|
<select name="#{model_pluralized}" onChange="surfto_#{model_pluralized}(this.form)">
|
|
174
|
-
<option value="#{url_for params_without_filter}">#{_(
|
|
174
|
+
<option value="#{url_for params_without_filter}">#{_("filter by")} #{_(model.human_name)}</option>
|
|
175
175
|
#{items.join("\n")}
|
|
176
176
|
</select>
|
|
177
177
|
</form></p>
|
|
@@ -46,7 +46,7 @@ module Admin::TableHelper
|
|
|
46
46
|
when 'index'
|
|
47
47
|
perform = link_to image_tag('admin/trash.gif'), { :action => 'destroy',
|
|
48
48
|
:id => item.id },
|
|
49
|
-
:confirm => _(
|
|
49
|
+
:confirm => _("Remove entry?"),
|
|
50
50
|
:method => :delete
|
|
51
51
|
else
|
|
52
52
|
perform = link_to image_tag('admin/trash.gif'), { :action => 'unrelate',
|
data/app/helpers/typus_helper.rb
CHANGED
|
@@ -29,7 +29,7 @@ module TypusHelper
|
|
|
29
29
|
<tr class="#{cycle('even', 'odd')}">
|
|
30
30
|
<td>#{link_to _(model.constantize.human_name.pluralize), admin_items_path}<br /><small>#{description}</small></td>
|
|
31
31
|
<td class="right"><small>
|
|
32
|
-
#{link_to _(
|
|
32
|
+
#{link_to _("Add"), new_admin_item_path if @current_user.can_perform?(model, 'create')}
|
|
33
33
|
</small></td>
|
|
34
34
|
</tr>
|
|
35
35
|
HTML
|
|
@@ -108,22 +108,26 @@ module TypusHelper
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
def page_title(action = params[:action])
|
|
111
|
-
crumbs = [
|
|
111
|
+
crumbs = [ ]
|
|
112
112
|
crumbs << @resource[:class].human_name.pluralize if @resource
|
|
113
113
|
crumbs << _(action.humanize) unless %w( index ).include?(action)
|
|
114
|
-
return crumbs.compact.map { |x| x }.join(' › ')
|
|
114
|
+
return "#{Typus::Configuration.options[:app_name]} - " + crumbs.compact.map { |x| x }.join(' › ')
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
def header
|
|
118
118
|
|
|
119
119
|
if ActionController::Routing::Routes.named_routes.routes.keys.include?(:root)
|
|
120
|
-
link_to_site =
|
|
121
|
-
<small>#{link_to _('View site'), root_path, :target => 'blank'}</small>
|
|
122
|
-
HTML
|
|
120
|
+
link_to_site = "<li>#{link_to _("View site"), root_path, :target => 'blank'}</li>"
|
|
123
121
|
end
|
|
124
122
|
|
|
123
|
+
link_to_dashboard = "<li>#{link_to _("Dashboard"), admin_dashboard_path}</li>"
|
|
124
|
+
|
|
125
125
|
<<-HTML
|
|
126
|
-
<h1>#{Typus::Configuration.options[:app_name]}
|
|
126
|
+
<h1>#{Typus::Configuration.options[:app_name]}</h1>
|
|
127
|
+
<ul>
|
|
128
|
+
#{link_to_dashboard}
|
|
129
|
+
#{link_to_site}
|
|
130
|
+
</ul>
|
|
127
131
|
HTML
|
|
128
132
|
|
|
129
133
|
end
|
|
@@ -136,8 +140,8 @@ module TypusHelper
|
|
|
136
140
|
|
|
137
141
|
<<-HTML
|
|
138
142
|
<ul>
|
|
139
|
-
<li>#{_(
|
|
140
|
-
<li>#{link_to _(
|
|
143
|
+
<li>#{_("Logged as")} #{link_to user.name, admin_edit_typus_user_path, :title => "#{user.email} (#{user.role})"}</li>
|
|
144
|
+
<li>#{link_to _("Sign out"), admin_sign_out_path }</li>
|
|
141
145
|
</ul>
|
|
142
146
|
HTML
|
|
143
147
|
|
|
@@ -171,7 +175,7 @@ module TypusHelper
|
|
|
171
175
|
locale_links = Typus.locales.map { |l| "<a href=\"#{uri}?locale=#{l.last}\">#{l.first.downcase}</a>" }
|
|
172
176
|
|
|
173
177
|
<<-HTML
|
|
174
|
-
<p>#{_(
|
|
178
|
+
<p>#{_("Set language to")} #{locale_links.join(', ')}.</p>
|
|
175
179
|
HTML
|
|
176
180
|
|
|
177
181
|
end
|
data/app/models/typus_mailer.rb
CHANGED
|
@@ -3,7 +3,7 @@ class TypusMailer < ActionMailer::Base
|
|
|
3
3
|
self.template_root = "#{File.dirname(__FILE__)}/../views"
|
|
4
4
|
|
|
5
5
|
def reset_password_link(user)
|
|
6
|
-
@subject = "[#{Typus::Configuration.options[:app_name]}] #{_(
|
|
6
|
+
@subject = "[#{Typus::Configuration.options[:app_name]}] #{_("Reset password")}"
|
|
7
7
|
@body = { :user => user }
|
|
8
8
|
@recipients = user.email
|
|
9
9
|
@from = Typus::Configuration.options[:email]
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
<%= display_link_to_previous if params[:back_to] %>
|
|
7
7
|
|
|
8
|
-
<h2><%= link_to _(
|
|
9
|
-
<%=
|
|
10
|
-
<%= _('Edit') %></h2>
|
|
8
|
+
<h2><%= link_to _(@resource[:class].human_name.pluralize), :action => 'index' %> ›
|
|
9
|
+
<%= _("Edit") %></h2>
|
|
11
10
|
|
|
12
11
|
<%= typus_block :location => @resource[:self], :partial => 'edit' %>
|
|
13
12
|
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
:resource_id => params[:resource_id]},
|
|
20
19
|
:html => { :multipart => true } do |f| %>
|
|
21
20
|
<%= build_form(@fields) %>
|
|
22
|
-
<p><%= submit_tag _(
|
|
21
|
+
<p><%= submit_tag _("Update entry"), :class => 'button' %></p>
|
|
23
22
|
<% end %>
|
|
24
23
|
|
|
25
24
|
<%= typus_relationships %>
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
<%= filters %>
|
|
6
6
|
<% end %>
|
|
7
7
|
|
|
8
|
-
<h2><%=
|
|
9
|
-
<%= _(@resource[:class].human_name.pluralize) %> <%= remove_filter_link %></h2>
|
|
8
|
+
<h2><%= _(@resource[:class].human_name.pluralize) %> <%= remove_filter_link %></h2>
|
|
10
9
|
|
|
11
10
|
<%= typus_block :location => @resource[:self], :partial => 'index' %>
|
|
12
11
|
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
<%= display_link_to_previous if params[:back_to] %>
|
|
7
7
|
|
|
8
|
-
<h2><%= link_to _(
|
|
9
|
-
<%=
|
|
10
|
-
<%= _('New') %></h2>
|
|
8
|
+
<h2><%= link_to _(@resource[:class].human_name.pluralize), :action => 'index' %> ›
|
|
9
|
+
<%= _("New") %></h2>
|
|
11
10
|
|
|
12
11
|
<%= typus_block :location => @resource[:self], :partial => 'new' %>
|
|
13
12
|
|
|
@@ -19,5 +18,5 @@
|
|
|
19
18
|
:resource_id => params[:resource_id] },
|
|
20
19
|
:html => { :multipart => true } do |f| %>
|
|
21
20
|
<%= build_form(@fields) %>
|
|
22
|
-
<p><%= submit_tag _(
|
|
21
|
+
<p><%= submit_tag _("Create entry"), :class => 'button' %></p>
|
|
23
22
|
<% end %>
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
<%= actions %>
|
|
4
4
|
<% end %>
|
|
5
5
|
|
|
6
|
-
<h2><%= link_to _(
|
|
7
|
-
<%=
|
|
8
|
-
<%= _('Show') %></h2>
|
|
6
|
+
<h2><%= link_to _(@resource[:class].human_name.pluralize), :action => 'index' %> ›
|
|
7
|
+
<%= _("Show") %></h2>
|
|
9
8
|
|
|
10
9
|
<%= typus_block :location => @resource[:self], :partial => 'show' %>
|
|
11
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<% form_tag admin_recover_password_path do %>
|
|
2
2
|
<ul>
|
|
3
|
-
<li><label for="email"><%= _(
|
|
3
|
+
<li><label for="email"><%= _("Email") %></label>
|
|
4
4
|
<%= text_field :user, :email, :size => 20, :class => 'text' %></li>
|
|
5
|
-
<li><%= submit_tag _(
|
|
5
|
+
<li><%= submit_tag _("Recover password"), :class => 'button' %> <%= link_to _("I remember my password"), admin_sign_in_path %></li>
|
|
6
6
|
</ul>
|
|
7
7
|
<% end %>
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<%= hidden_field_tag :token, @user.token %>
|
|
4
4
|
|
|
5
5
|
<ul>
|
|
6
|
-
<li><label for="password"><%= _(
|
|
6
|
+
<li><label for="password"><%= _("Password") %></label>
|
|
7
7
|
<%= password_field :user, :password, :size => 20, :class => 'text' %></li>
|
|
8
|
-
<li><label for="password"><%= _(
|
|
8
|
+
<li><label for="password"><%= _("Password confirm") %></label>
|
|
9
9
|
<%= password_field :user, :password_confirmation, :size => 20, :class => 'text' %></li>
|
|
10
|
-
<li><%= submit_tag _(
|
|
10
|
+
<li><%= submit_tag _("Change password"), :class => 'button' %> <%= link_to _("I remember my password"), admin_sign_in_path %></li>
|
|
11
11
|
</ul>
|
|
12
12
|
|
|
13
13
|
<% end %>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<% form_tag admin_sign_in_path(:back_to => params[:back_to]) do %>
|
|
2
2
|
<ul>
|
|
3
|
-
<li><label for="email"><%= _(
|
|
3
|
+
<li><label for="email"><%= _("Email") %></label>
|
|
4
4
|
<%= text_field :user, :email, :size => 20, :class => 'text' %></li>
|
|
5
|
-
<li><label for="password"><%= _(
|
|
5
|
+
<li><label for="password"><%= _("Password") %></label>
|
|
6
6
|
<%= password_field :user, :password, :size => 20, :class => 'text' %></li>
|
|
7
|
-
<li><%= submit_tag _(
|
|
7
|
+
<li><%= submit_tag _("Sign in"), :class => 'button' %> <%= link_to _("Recover password"), admin_recover_password_path if Typus::Configuration.options[:recover_password] %></li>
|
|
8
8
|
</ul>
|
|
9
9
|
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<% form_tag admin_sign_up_path do %>
|
|
2
2
|
<ul>
|
|
3
|
-
<li><label for="email"><%= _(
|
|
3
|
+
<li><label for="email"><%= _("Email") %></label>
|
|
4
4
|
<%= text_field :user, :email, :size => 20, :class => 'text' %></li>
|
|
5
|
-
<li><%= submit_tag _(
|
|
5
|
+
<li><%= submit_tag _("Sign up"), :class => 'button' %></li>
|
|
6
6
|
</ul>
|
|
7
7
|
<% end %>
|
|
@@ -89,14 +89,13 @@ a.on {
|
|
|
89
89
|
padding: 1em 0;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
#header h1 {
|
|
92
|
+
#header h1 {
|
|
93
|
+
display: block;
|
|
94
|
+
float: left;
|
|
93
95
|
font-size: 2em;
|
|
96
|
+
margin-right: 0.25em;
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
#header h1 small {
|
|
97
|
-
font-size: 0.5em;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
99
|
#header a {
|
|
101
100
|
color: #FFF;
|
|
102
101
|
}
|
|
@@ -110,9 +109,16 @@ a.on {
|
|
|
110
109
|
margin-top: 1em;
|
|
111
110
|
}
|
|
112
111
|
|
|
112
|
+
#header .left ul {
|
|
113
|
+
display: block;
|
|
114
|
+
float: left;
|
|
115
|
+
margin-top: 1em;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#header .left li,
|
|
113
119
|
#header .right li {
|
|
114
120
|
display: inline;
|
|
115
|
-
padding-left:
|
|
121
|
+
padding-left: 0.5em;
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
/* @end */
|
data/lib/typus/generator.rb
CHANGED
data/lib/typus/object.rb
CHANGED
|
@@ -3,15 +3,15 @@ class Object
|
|
|
3
3
|
##
|
|
4
4
|
# Instead of having to translate strings and defining a default value:
|
|
5
5
|
#
|
|
6
|
-
# t(
|
|
6
|
+
# t("Hello World!", :default => 'Hello World!')
|
|
7
7
|
#
|
|
8
8
|
# We define this method to define the value only once:
|
|
9
9
|
#
|
|
10
|
-
# _(
|
|
10
|
+
# _("Hello World!")
|
|
11
11
|
#
|
|
12
12
|
# Note that interpolation still works ...
|
|
13
13
|
#
|
|
14
|
-
# _(
|
|
14
|
+
# _("Hello {{world}}!", :world => @world)
|
|
15
15
|
#
|
|
16
16
|
def _(msg, *args)
|
|
17
17
|
options = args.extract_options!
|
|
@@ -41,26 +41,18 @@ class Admin::CommentsControllerTest < ActionController::TestCase
|
|
|
41
41
|
|
|
42
42
|
def test_should_verify_page_title_on_index
|
|
43
43
|
get :index
|
|
44
|
-
assert_select 'title',
|
|
45
|
-
assert_select 'title', /Comments/
|
|
46
|
-
assert_select 'title', /›/
|
|
44
|
+
assert_select 'title', "#{Typus::Configuration.options[:app_name]} - Comments"
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
def test_should_verify_page_title_on_new
|
|
50
48
|
get :new
|
|
51
|
-
assert_select 'title',
|
|
52
|
-
assert_select 'title', /Comments/
|
|
53
|
-
assert_select 'title', /New/
|
|
54
|
-
assert_select 'title', /›/
|
|
49
|
+
assert_select 'title', "#{Typus::Configuration.options[:app_name]} - Comments › New"
|
|
55
50
|
end
|
|
56
51
|
|
|
57
52
|
def test_should_verify_page_title_on_edit
|
|
58
53
|
comment = comments(:first)
|
|
59
54
|
get :edit, :id => comment.id
|
|
60
|
-
assert_select 'title',
|
|
61
|
-
assert_select 'title', /Comments/
|
|
62
|
-
assert_select 'title', /Edit/
|
|
63
|
-
assert_select 'title', /›/
|
|
55
|
+
assert_select 'title', "#{Typus::Configuration.options[:app_name]} - Comments › Edit"
|
|
64
56
|
end
|
|
65
57
|
|
|
66
58
|
def test_should_show_add_new_link_in_index
|
|
@@ -180,7 +180,7 @@ class TypusControllerTest < ActionController::TestCase
|
|
|
180
180
|
|
|
181
181
|
def test_should_verify_page_title_on_sign_in
|
|
182
182
|
get :sign_in
|
|
183
|
-
assert_select 'title', "#{Typus::Configuration.options[:app_name]}
|
|
183
|
+
assert_select 'title', "#{Typus::Configuration.options[:app_name]} - Sign in"
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
def test_should_create_first_typus_user
|
|
@@ -247,7 +247,7 @@ class TypusControllerTest < ActionController::TestCase
|
|
|
247
247
|
def test_should_verify_page_title_on_dashboard
|
|
248
248
|
@request.session[:typus_user_id] = typus_users(:admin).id
|
|
249
249
|
get :dashboard
|
|
250
|
-
assert_select 'title', "#{Typus::Configuration.options[:app_name]}
|
|
250
|
+
assert_select 'title', "#{Typus::Configuration.options[:app_name]} - Dashboard"
|
|
251
251
|
end
|
|
252
252
|
|
|
253
253
|
def test_should_verify_link_to_edit_typus_user
|
data/test/helper.rb
CHANGED
|
@@ -3,12 +3,6 @@ ENV['RAILS_ENV'] = 'test'
|
|
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
|
|
4
4
|
require 'test_help'
|
|
5
5
|
require 'mocha'
|
|
6
|
-
require 'time'
|
|
7
|
-
|
|
8
|
-
def Time.today
|
|
9
|
-
t = now()
|
|
10
|
-
mktime( t.year, t.mon, t.day )
|
|
11
|
-
end unless Time.respond_to?(:today)
|
|
12
6
|
|
|
13
7
|
begin
|
|
14
8
|
require 'redgreen'
|
|
@@ -25,7 +25,7 @@ class TypusHelperTest < ActiveSupport::TestCase
|
|
|
25
25
|
options = { :app_name => 'whatistypus.com' }
|
|
26
26
|
Typus::Configuration.stubs(:options).returns(options)
|
|
27
27
|
output = page_title('custom_action')
|
|
28
|
-
assert_equal 'whatistypus.com
|
|
28
|
+
assert_equal 'whatistypus.com - Custom action', output
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def test_header_with_root_path
|
|
@@ -39,8 +39,11 @@ class TypusHelperTest < ActiveSupport::TestCase
|
|
|
39
39
|
|
|
40
40
|
output = header
|
|
41
41
|
expected = <<-HTML
|
|
42
|
-
<h1>#{Typus::Configuration.options[:app_name]}
|
|
43
|
-
|
|
42
|
+
<h1>#{Typus::Configuration.options[:app_name]}</h1>
|
|
43
|
+
<ul>
|
|
44
|
+
<li><a href="/">View site</a></li>
|
|
45
|
+
<li><a href="/">View site</a></li>
|
|
46
|
+
</ul>
|
|
44
47
|
HTML
|
|
45
48
|
|
|
46
49
|
assert_equal expected, output
|
|
@@ -52,9 +55,15 @@ class TypusHelperTest < ActiveSupport::TestCase
|
|
|
52
55
|
# Remove root route from list
|
|
53
56
|
ActionController::Routing::Routes.named_routes.routes.reject! {|key, route| key == :root }
|
|
54
57
|
|
|
58
|
+
self.stubs(:link_to).returns(%(<a href="/admin/dashboard">Dashboard</a>))
|
|
59
|
+
|
|
55
60
|
output = header
|
|
56
61
|
expected = <<-HTML
|
|
57
|
-
<h1>#{Typus::Configuration.options[:app_name]}
|
|
62
|
+
<h1>#{Typus::Configuration.options[:app_name]}</h1>
|
|
63
|
+
<ul>
|
|
64
|
+
<li><a href="/admin/dashboard">Dashboard</a></li>
|
|
65
|
+
|
|
66
|
+
</ul>
|
|
58
67
|
HTML
|
|
59
68
|
|
|
60
69
|
assert_equal expected, output
|
data/typus.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{typus}
|
|
5
|
-
s.version = "0.9.
|
|
5
|
+
s.version = "0.9.9"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Francesc Esplugas"]
|
|
9
|
-
s.date = %q{2009-06-
|
|
9
|
+
s.date = %q{2009-06-13}
|
|
10
10
|
s.description = %q{Effortless backend interface for Ruby on Rails applications. (Admin scaffold generator.)}
|
|
11
11
|
s.email = %q{francesc@intraducibles.com}
|
|
12
12
|
s.extra_rdoc_files = [
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fesplugas-typus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Francesc Esplugas
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-06-
|
|
12
|
+
date: 2009-06-13 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|