typo 5.4.3 → 5.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/CHANGELOG +21 -8
  2. data/README +2 -2
  3. data/app/controllers/accounts_controller.rb +6 -10
  4. data/app/controllers/admin/content_controller.rb +2 -3
  5. data/app/controllers/admin/profiles_controller.rb +0 -1
  6. data/app/controllers/admin/resources_controller.rb +6 -20
  7. data/app/controllers/articles_controller.rb +5 -5
  8. data/app/controllers/setup_controller.rb +45 -0
  9. data/app/controllers/xml_controller.rb +0 -9
  10. data/app/helpers/admin/base_helper.rb +50 -33
  11. data/app/helpers/admin/categories_helper.rb +12 -0
  12. data/app/helpers/admin/feedback_helper.rb +10 -0
  13. data/app/helpers/application_helper.rb +13 -0
  14. data/app/models/blog.rb +0 -10
  15. data/app/models/content.rb +4 -3
  16. data/app/models/feedback.rb +1 -0
  17. data/app/models/feedback/states.rb +2 -1
  18. data/app/models/resource.rb +0 -26
  19. data/app/models/user.rb +2 -2
  20. data/app/views/accounts/confirm.html.erb +1 -16
  21. data/app/views/accounts/login.html.erb +9 -17
  22. data/app/views/accounts/recover_password.html.erb +5 -8
  23. data/app/views/accounts/signup.html.erb +1 -0
  24. data/app/views/admin/categories/_categories.html.erb +11 -3
  25. data/app/views/admin/categories/index.html.erb +6 -9
  26. data/app/views/admin/categories/reorder.html.erb +5 -3
  27. data/app/views/admin/content/_article_list.html.erb +9 -4
  28. data/app/views/admin/content/_drafts.html.erb +7 -5
  29. data/app/views/admin/content/_form.html.erb +91 -83
  30. data/app/views/admin/content/_images.html.erb +4 -0
  31. data/app/views/admin/content/_visual_editor.html.erb +1 -0
  32. data/app/views/admin/content/index.html.erb +35 -38
  33. data/app/views/admin/dashboard/_comments.html.erb +17 -12
  34. data/app/views/admin/dashboard/_inbound.html.erb +11 -4
  35. data/app/views/admin/dashboard/_overview.html.erb +18 -8
  36. data/app/views/admin/dashboard/_popular.html.erb +17 -12
  37. data/app/views/admin/dashboard/_posts.html.erb +18 -13
  38. data/app/views/admin/dashboard/_typo_dev.html.erb +10 -6
  39. data/app/views/admin/dashboard/_welcome.html.erb +17 -3
  40. data/app/views/admin/dashboard/index.html.erb +9 -16
  41. data/app/views/admin/feedback/_button.html.erb +7 -7
  42. data/app/views/admin/feedback/_form.html.erb +28 -28
  43. data/app/views/admin/feedback/_item.html.erb +10 -3
  44. data/app/views/admin/feedback/article.html.erb +6 -5
  45. data/app/views/admin/feedback/index.html.erb +35 -37
  46. data/app/views/admin/pages/_form.html.erb +30 -42
  47. data/app/views/admin/pages/_pages.html.erb +15 -34
  48. data/app/views/admin/pages/_visual_editor.html.erb +1 -0
  49. data/app/views/admin/pages/index.html.erb +13 -6
  50. data/app/views/admin/profiles/index.html.erb +6 -4
  51. data/app/views/admin/resources/_upload.html.erb +15 -8
  52. data/app/views/admin/resources/images.html.erb +1 -1
  53. data/app/views/admin/resources/index.html.erb +1 -17
  54. data/app/views/admin/settings/_submit.html.erb +1 -1
  55. data/app/views/admin/settings/feedback.html.erb +96 -91
  56. data/app/views/admin/settings/index.html.erb +74 -74
  57. data/app/views/admin/settings/seo.html.erb +67 -66
  58. data/app/views/admin/settings/update_database.html.erb +24 -24
  59. data/app/views/admin/settings/write.html.erb +24 -70
  60. data/app/views/admin/sidebar/_active.html.erb +9 -8
  61. data/app/views/admin/sidebar/_available.html.erb +5 -3
  62. data/app/views/admin/sidebar/index.html.erb +12 -12
  63. data/app/views/admin/themes/catalogue.html.erb +16 -3
  64. data/app/views/admin/themes/index.html.erb +23 -13
  65. data/app/views/admin/users/_form.html.erb +180 -175
  66. data/app/views/admin/users/edit.html.erb +4 -5
  67. data/app/views/admin/users/index.html.erb +4 -3
  68. data/app/views/admin/users/new.html.erb +5 -7
  69. data/app/views/layouts/accounts.html.erb +7 -9
  70. data/app/views/layouts/administration.html.erb +21 -27
  71. data/app/views/layouts/setup.html.erb +18 -0
  72. data/app/views/notification_mailer/notif_user.html.erb +14 -12
  73. data/app/views/setup/confirm.html.erb +1 -0
  74. data/app/views/setup/index.html.erb +17 -0
  75. data/app/views/shared/_confirm.html.erb +16 -0
  76. data/config/environment.rb +3 -2
  77. data/config/initializers/access_rules.rb +0 -1
  78. data/config/routes.rb +4 -3
  79. data/db/migrate/087_drop_blacklist_patterns.rb +14 -0
  80. data/db/migrate/088_drop_session_table.rb +14 -0
  81. data/db/schema.rb +29 -37
  82. data/doc/Installer.txt +3 -3
  83. data/lib/spam_protection.rb +0 -10
  84. data/lib/tasks/release.rake +1 -1
  85. data/lib/typo_version.rb +1 -1
  86. data/public/images/admin/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
  87. data/public/images/admin/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
  88. data/public/images/admin/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
  89. data/public/images/admin/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
  90. data/public/images/admin/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
  91. data/public/images/admin/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
  92. data/public/images/admin/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
  93. data/public/images/admin/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
  94. data/public/images/admin/ui-bg_highlight-soft_50_116088_1x100.png +0 -0
  95. data/public/images/admin/ui-icons_2694e8_256x240.png +0 -0
  96. data/public/images/admin/ui-icons_2e83ff_256x240.png +0 -0
  97. data/public/images/admin/ui-icons_3d80b3_256x240.png +0 -0
  98. data/public/images/admin/ui-icons_72a7cf_256x240.png +0 -0
  99. data/public/images/admin/ui-icons_ffffff_256x240.png +0 -0
  100. data/public/javascripts/lightbox.js +2 -2
  101. data/public/stylesheets/accounts.css +119 -0
  102. data/public/stylesheets/administration.css +598 -625
  103. data/spec/controllers/accounts_controller_spec.rb +94 -12
  104. data/spec/controllers/admin/categories_controller_spec.rb +0 -11
  105. data/spec/controllers/admin/profiles_controller_spec.rb +2 -2
  106. data/spec/controllers/admin/resources_controller_spec.rb +15 -2
  107. data/spec/controllers/articles_controller_spec.rb +27 -0
  108. data/spec/controllers/routes/xml_routing_spec.rb +0 -8
  109. data/spec/controllers/setup_controller_spec.rb +24 -0
  110. data/spec/controllers/xml_controller_spec.rb +0 -7
  111. data/spec/models/comment_spec.rb +37 -7
  112. data/spec/models/configuration_spec.rb +0 -11
  113. data/spec/models/trackback_spec.rb +0 -8
  114. data/spec/models/user_spec.rb +9 -0
  115. data/spec/spec_helper.rb +1 -1
  116. data/test/fixtures/blogs.yml +0 -8
  117. data/test/fixtures/users.yml +1 -0
  118. data/vendor/plugins/upload_progress/lib/upload_progress_helper.rb +1 -1
  119. metadata +26 -38
  120. data/app/controllers/admin/blacklist_controller.rb +0 -47
  121. data/app/helpers/admin/blacklist_helper.rb +0 -2
  122. data/app/models/blacklist_pattern.rb +0 -24
  123. data/app/views/admin/base/_recent_comments.html.erb +0 -10
  124. data/app/views/admin/base/_recent_trackbacks.html.erb +0 -10
  125. data/app/views/admin/blacklist/_blacklist_patterns.html.erb +0 -16
  126. data/app/views/admin/blacklist/_form.html.erb +0 -14
  127. data/app/views/admin/blacklist/_quick_post.html.erb +0 -9
  128. data/app/views/admin/blacklist/destroy.html.erb +0 -10
  129. data/app/views/admin/blacklist/edit.html.erb +0 -10
  130. data/app/views/admin/blacklist/index.html.erb +0 -10
  131. data/app/views/admin/dashboard/_sysinfo.html.erb +0 -11
  132. data/app/views/admin/resources/_itunes_category_add.html.erb +0 -11
  133. data/app/views/admin/resources/_itunes_category_edit.html.erb +0 -32
  134. data/app/views/admin/resources/_metadata_add.html.erb +0 -22
  135. data/app/views/admin/resources/_metadata_edit.html.erb +0 -22
  136. data/config/iTunes.yml +0 -72
  137. data/db/typo_dev +0 -0
  138. data/public/images/admin/blue_block_bottom_left.jpg +0 -0
  139. data/public/images/admin/blue_block_bottom_right.jpg +0 -0
  140. data/public/images/admin/blue_block_top_left.jpg +0 -0
  141. data/public/images/admin/blue_block_top_right.jpg +0 -0
  142. data/public/images/admin/editor_active_top_left.jpg +0 -0
  143. data/public/images/admin/editor_active_top_right.jpg +0 -0
  144. data/public/images/admin/editor_bottom_left.jpg +0 -0
  145. data/public/images/admin/editor_bottom_right.jpg +0 -0
  146. data/public/images/admin/input_text_left.jpg +0 -0
  147. data/public/images/admin/input_text_right.jpg +0 -0
  148. data/public/images/admin/input_text_small_left.jpg +0 -0
  149. data/public/images/admin/input_text_small_right.jpg +0 -0
  150. data/public/images/admin/publisher_bottom.jpg +0 -0
  151. data/public/images/admin/publisher_top.jpg +0 -0
  152. data/public/stylesheets/border-radius-ie8.htc +0 -34
  153. data/spec/controllers/admin/blacklist_controller_spec.rb +0 -54
  154. data/spec/models/blacklist_pattern_spec.rb +0 -12
  155. data/test/fixtures/blacklist_patterns.yml +0 -8
data/CHANGELOG CHANGED
@@ -1,15 +1,28 @@
1
- Typo 5.4.3 fixes some nasty bugs that went through Typo 5.4.2 despite running tests before releasing. If you've been using Typo 5.4.2, you really should upgrade. And if you're running any prior version, you should upgrade too.
1
+ After releasing Typo 5.4.3, we realized something we actually knew for a while. If we wanted Typo to spread more, we had to make it prettier, easier to install and easier to use. That may sound obvious, but we were working with a quite old product, having legacy feature we didn't need, but, for some reason, we kept release after release, trying to work around instead of just dumping them. If we wanted to make Typo better, we first had to make it smaller. Dead obvious once again.
2
2
 
3
- Now sorting articles by publication date instead of creation date in the admin.
3
+ Being the fourth of the Willy Ronis series, that version is the first going towards simplification: less useless feature, simpler, better interface, and lighter memory footprint.
4
4
 
5
- In the admin, comment forms fields are now filled with the user info. Url and
6
- email fields have been switched too to fit front end comment forms.
5
+ Typo now comes with a new, easier to use setup that suppresses needed initial configuration. Just provide an email and a blog title, and you're done. This setup is the first stone in refreshing Typo installation process.
7
6
 
8
- Extending the editor a little bit, easier to use now.
7
+ Previous admin refresh was not very satisfying, and we needed to rework it. Instead of trying to play the webdesigners, which none of us is, we used Jquery UI for the graphic part, and focused on Typo interface instead. The result is, for now, quite satisfying, even though we know we still can improve it.
9
8
 
10
- Ticket 143: Publish at post setting does not work
9
+ IPs and pattern blacklist has been completely removed. With Akismet and real time blacklist (RBL), Typo already provided 2 simple ways to fight against spam. Blacklisting IPs and patterns was a very advanced feature, which is definitely not a blogware job. If people want to do that type of filtering, they have many way to do it, using intrusion detection systems (IDS), Apache mod_security, or even packet filtering such as Linux Netfilter.
10
+
11
+ For ages, Typo provided a full iTunes metadata support for podcast publishers. We've completely removed them since it was useless for 99.99% of us. Typo still supports enclosure (files attached to a blog post, appearing in the RSS feed but not on the post itself) though.
12
+
13
+ We've also resolved a bunch of bugs as well:
14
+
15
+ The main reason why we've released that new version so early was because of a bug in the visual editor, losing posts content at saving time. Editors are very difficult to test since they rely on Javascript. However, we plan to add some Watir tests in a near future.
16
+
17
+ #152: fix poor email grammar.
18
+
19
+ #148: fixes a bug that prevents admin to edit a user without providing his password.
20
+
21
+ #160: 404 error on the lightbox loading.gif and closelabel.gif.
22
+
23
+ #155: after deleting an image, the file page is loaded.
24
+
25
+ #143: publishing posts in the future didn't work unless you manually unpublishes them.
11
26
 
12
- Fixing a critial bug that made the page editor crash at loading.
13
27
 
14
- Fixing a bug in RDOC that raised an error when installing.
15
28
 
data/README CHANGED
@@ -12,8 +12,8 @@ Requirements
12
12
 
13
13
  Currently you need all of those things to get typo to run:
14
14
 
15
- * Ruby 1.8.6 or Ruby Enterprise Edition.
16
- * Rails 2.3.5, Typo 5.4.3 DOES NOT support any older Rails version.
15
+ * Ruby 1.8.6, 1.8.7 or Ruby Enterprise Edition.
16
+ * Rails 2.3.5, Typo 5.4.4 DOES NOT support any older Rails version.
17
17
  * A database. Typo supports MySQL, PostgreSQL, and SQLite.
18
18
  * Ruby drivers for your database.
19
19
  * For best performance, you should have a web server running either
@@ -1,5 +1,6 @@
1
1
  class AccountsController < ApplicationController
2
2
 
3
+ before_filter :verify_config
3
4
  before_filter :verify_users, :only => [:login, :recover_password]
4
5
  filter_parameter_logging "password"
5
6
 
@@ -53,14 +54,7 @@ class AccountsController < ApplicationController
53
54
  if @user.save
54
55
  self.current_user = @user
55
56
  session[:user_id] = @user.id
56
-
57
- # Crappy hack : by default, the auto generated post is user_id less and it makes Typo crash
58
- if User.count == 1
59
- art = Article.find(:first)
60
- art.user_id = @user.id
61
- art.save
62
- end
63
-
57
+
64
58
  redirect_to :controller => "accounts", :action => "confirm"
65
59
  return
66
60
  end
@@ -94,7 +88,6 @@ class AccountsController < ApplicationController
94
88
  end
95
89
 
96
90
  private
97
-
98
91
  def generate_password
99
92
  chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
100
93
  newpass = ""
@@ -106,5 +99,8 @@ class AccountsController < ApplicationController
106
99
  redirect_to(:controller => "accounts", :action => "signup") if User.count == 0
107
100
  true
108
101
  end
109
-
102
+
103
+ def verify_config
104
+ redirect_to :controller => "setup", :action => "index" if ! this_blog.configured?
105
+ end
110
106
  end
@@ -113,7 +113,7 @@ class Admin::ContentController < Admin::BaseController
113
113
  render(:update) do |page|
114
114
  page.replace_html('autosave', hidden_field_tag('id', @article.id))
115
115
  page.replace_html('permalink', text_field('article', 'permalink', {:class => 'small medium'}))
116
- page.replace_html('preview_link', link_to(_("Preview"), {:controller => '/previews', :id => @article.id }, {:target => 'new'}))
116
+ page.replace_html('preview_link', link_to(_("Preview"), {:controller => '/articles', :action => 'preview', :id => @article.id}, {:target => 'new'}))
117
117
  end
118
118
 
119
119
  return true
@@ -146,11 +146,10 @@ class Admin::ContentController < Admin::BaseController
146
146
  # TODO Test if we can delete the next line. It's delete on nice_permalinks branch
147
147
  params[:article] ||= {}
148
148
 
149
- @resources = Resource.find(:all, :order => 'filename')
149
+ @resources = Resource.find(:all, :conditions => "mime NOT LIKE '%image%'", :order => 'filename')
150
150
  @images = Resource.paginate :page => params[:page], :conditions => "mime LIKE '%image%'", :order => 'created_at DESC', :per_page => 10
151
151
  @article.attributes = params[:article]
152
152
 
153
-
154
153
  if request.post?
155
154
  set_article_author
156
155
  save_attachments
@@ -8,7 +8,6 @@ class Admin::ProfilesController < Admin::BaseController
8
8
  if request.post? and @user.save
9
9
  current_user = @user
10
10
  flash[:notice] = _('User was successfully updated.')
11
- redirect_to :controller => '/admin', :action => 'index'
12
11
  end
13
12
  end
14
13
 
@@ -28,28 +28,10 @@ class Admin::ResourcesController < Admin::BaseController
28
28
  end
29
29
  end
30
30
 
31
- def remove_itunes_metadata
32
- @resource = Resource.find(params[:id])
33
- @resource.itunes_metadata = false
34
- @resource.save(false)
35
- flash[:notice] = _('Metadata was successfully removed.')
36
- redirect_to :action => 'index'
37
- end
38
-
39
31
  def update
40
32
  @resource = Resource.find(params[:resource][:id])
41
33
  @resource.attributes = params[:resource]
42
34
 
43
- unless params[:itunes_category].nil?
44
- itunes_categories = params[:itunes_category]
45
- itunes_category_pre = Hash.new {|h, k| h[k] = [] }
46
- itunes_categories.each do |cat|
47
- cat_split = cat.split('-')
48
- itunes_category_pre[cat_split[0]] << cat_split[1] unless
49
- itunes_category_pre[cat_split[0]].include?(cat_split[0])
50
- end
51
- @resource.itunes_category = itunes_category_pre
52
- end
53
35
  if request.post? and @resource.save
54
36
  flash[:notice] = _('Metadata was successfully updated.')
55
37
  else
@@ -78,7 +60,6 @@ class Admin::ResourcesController < Admin::BaseController
78
60
 
79
61
  def index
80
62
  @r = Resource.new
81
- @itunes_category_list = @r.get_itunes_categories
82
63
  @resources = Resource.paginate :page => params[:page], :conditions => "mime NOT LIKE '%image%'", :order => 'created_at DESC', :per_page => this_blog.admin_display_elements
83
64
  end
84
65
 
@@ -98,10 +79,15 @@ class Admin::ResourcesController < Admin::BaseController
98
79
  def destroy
99
80
  begin
100
81
  @file = Resource.find(params[:id])
82
+ mime = @file.mime
101
83
  case request.method
102
84
  when :post
103
85
  @file.destroy
104
- redirect_to :action => 'index'
86
+ if mime =~ /image/
87
+ redirect_to :action => 'images'
88
+ else
89
+ redirect_to :action => 'index'
90
+ end
105
91
  end
106
92
  rescue
107
93
  raise
@@ -1,8 +1,8 @@
1
1
  class ArticlesController < ContentController
2
- before_filter :verify_config
3
2
  before_filter :login_required, :only => [:preview]
4
3
  before_filter :auto_discovery_feed, :only => [:show, :index]
5
-
4
+ before_filter :verify_config
5
+
6
6
  layout :theme_layout, :except => [:comment_preview, :trackback]
7
7
 
8
8
  cache_sweeper :blog_sweeper
@@ -187,10 +187,10 @@ class ArticlesController < ContentController
187
187
  private
188
188
 
189
189
  def verify_config
190
- if User.count == 0
190
+ if ! this_blog.configured?
191
+ redirect_to :controller => "setup", :action => "index"
192
+ elsif User.count == 0
191
193
  redirect_to :controller => "accounts", :action => "signup"
192
- elsif ! this_blog.configured?
193
- redirect_to :controller => "admin/settings", :action => "redirect"
194
194
  else
195
195
  return true
196
196
  end
@@ -0,0 +1,45 @@
1
+ class SetupController < ApplicationController
2
+ before_filter :check_config, :only => 'index'
3
+ layout 'setup'
4
+
5
+ def index
6
+ if request.post?
7
+ Blog.transaction do
8
+ this_blog.blog_name = params[:setting][:blog_name]
9
+ this_blog.base_url = blog_base_url
10
+ this_blog.save
11
+ end
12
+
13
+ @user = User.new(:login => 'admin', :email => params[:setting][:email])
14
+
15
+ @user.password = generate_password
16
+ session[:tmppass] = @user.password
17
+ @user.name = @user.login
18
+ if @user.save
19
+ self.current_user = @user
20
+ session[:user_id] = @user.id
21
+
22
+ # Crappy hack : by default, the auto generated post is user_id less and it makes Typo crash
23
+ if User.count == 1
24
+ art = Article.find(:first)
25
+ art.user_id = @user.id
26
+ art.save
27
+ end
28
+ end
29
+ redirect_to :action => 'confirm'
30
+ end
31
+ end
32
+
33
+ private
34
+ def generate_password
35
+ chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
36
+ newpass = ""
37
+ 1.upto(7) { |i| newpass << chars[rand(chars.size-1)] }
38
+ return newpass
39
+ end
40
+
41
+ def check_config
42
+ return unless this_blog.configured?
43
+ redirect_to :controller => 'articles', :action => 'index'
44
+ end
45
+ end
@@ -55,15 +55,6 @@ class XmlController < ApplicationController
55
55
  end
56
56
  end
57
57
 
58
- def itunes
59
- @feed_title = "#{this_blog.blog_name} Podcast"
60
- @items = Resource.find(:all, :order => 'created_at DESC',
61
- :conditions => ['itunes_metadata = ?', true], :limit => this_blog.limit_rss_display)
62
- respond_to do |format|
63
- format.rss { render :action => "itunes_feed" }
64
- end
65
- end
66
-
67
58
  def articlerss
68
59
  redirect_to :action => 'feed', :format => 'rss', :type => 'article', :id => params[:id]
69
60
  end
@@ -4,18 +4,22 @@ module Admin::BaseHelper
4
4
  def subtabs_for(current_module)
5
5
  output = []
6
6
  AccessControl.project_module(current_user.profile.label, current_module).submenus.each_with_index do |m,i|
7
- current = (m.url[:controller] == params[:controller] && m.url[:action] == params[:action]) ? "current" : ""
8
- output << subtab(_(m.name), current, m.url)
7
+ current =
8
+ output << subtab(_(m.name), (m.url[:controller] == params[:controller] && m.url[:action] == params[:action]) ? '' : m.url)
9
9
  end
10
10
  content_for(:tasks) { output.join("\n") }
11
11
  end
12
12
 
13
- def subtab(label, style, options = {})
14
- content_tag :li, link_to(label, options, { "class"=> style })
13
+ def subtab(label, options = {})
14
+ return content_tag :li, "<span class='subtabs'>#{label}</span>" if options.empty?
15
+ content_tag :li, link_to(label, options)
15
16
  end
16
17
 
17
18
  def show_page_heading
18
- content_tag(:h2, @page_heading, :class => 'mb20') unless @page_heading.blank?
19
+ heading = ""
20
+ heading << content_tag(:div, @link_to_new, :class => 'page_new') unless @link_to_new.blank?
21
+ heading << content_tag(:h2, @page_heading, :class => 'page_heading') unless @page_heading.blank?
22
+
19
23
  end
20
24
 
21
25
  def cancel(url = {:action => 'index'})
@@ -30,14 +34,6 @@ module Admin::BaseHelper
30
34
  '<input type="submit" value="' + val + '" />'
31
35
  end
32
36
 
33
- def link_to_show(record, controller = @controller.controller_name)
34
- if record.published?
35
- link_to image_tag('admin/show.png', :alt => _("show"), :title => _("Show content")),
36
- {:controller => controller, :action => 'show', :id => record.id},
37
- {:class => "lbOn"}
38
- end
39
- end
40
-
41
37
  def link_to_edit(label, record, controller = @controller.controller_name)
42
38
  link_to label, :controller => controller, :action => 'edit', :id => record.id
43
39
  end
@@ -88,48 +84,50 @@ module Admin::BaseHelper
88
84
  content_tag :li, link_to(_('Back to overview'), :action => 'index')
89
85
  end
90
86
 
91
- def task_add_resource_metadata(title,id)
92
- link_to_function(title, toggle_effect('add-resource-metadata-' + id.to_s, 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
87
+ def task_edit_resource_mime(title,id)
88
+ link_to_function(title, toggle_effect('edit-resource-mime-' + id.to_s, 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
93
89
  end
94
90
 
95
- def task_edit_resource_metadata(title,id)
96
- link_to_function(title, toggle_effect('edit-resource-metadata-' + id.to_s, 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
91
+ def class_tab
92
+ 'ui-state-default ui-corner-top'
97
93
  end
98
94
 
99
- def task_edit_resource_mime(title,id)
100
- link_to_function(title, toggle_effect('edit-resource-mime-' + id.to_s, 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
95
+ def class_selected_tab
96
+ 'ui-state-default ui-corner-top ui-tabs-selected ui-state-active'
101
97
  end
102
98
 
103
99
  def class_write
104
100
  if controller.controller_name == "content" or controller.controller_name == "pages"
105
- "current" if controller.action_name == "new"
101
+ return class_selected_tab if controller.action_name == 'new' || controller.action_name == 'edit'
106
102
  end
103
+ class_tab
107
104
  end
108
105
 
109
106
  def class_content
110
107
  if controller.controller_name =~ /content|pages|categories|resources|feedback/
111
- "current" if controller.action_name =~ /list|index|show/
108
+ return class_selected_tab if controller.action_name =~ /list|index|show|article/
112
109
  end
110
+ class_tab
113
111
  end
114
112
 
115
113
  def class_themes
116
- "current" if controller.controller_name =~ /themes|sidebar/
114
+ return class_selected_tab if controller.controller_name =~ /themes|sidebar/
115
+ class_tab
117
116
  end
118
117
 
119
- def class_users
120
- controller.controller_name =~ /users/ ? "current right" : "right"
121
- end
122
-
123
118
  def class_dashboard
124
- controller.controller_name =~ /dashboard/ ? "current right" : "right"
119
+ return class_selected_tab if controller.controller_name =~ /dashboard/
120
+ class_tab
125
121
  end
126
122
 
127
123
  def class_settings
128
- controller.controller_name =~ /settings|textfilter/ ? "current right" : "right"
124
+ return class_selected_tab if controller.controller_name =~ /settings|users/
125
+ class_tab
129
126
  end
130
127
 
131
128
  def class_profile
132
- controller.controller_name =~ /profiles/ ? "current right" : "right"
129
+ return class_selected_tab if controller.controller_name =~ /profiles/
130
+ class_tab
133
131
  end
134
132
 
135
133
  def alternate_editor
@@ -161,7 +159,7 @@ module Admin::BaseHelper
161
159
  end
162
160
 
163
161
  def cancel_or_save
164
- result = '<p class="right">'
162
+ result = '<p>'
165
163
  result << cancel
166
164
  result << " "
167
165
  result << _("or")
@@ -170,10 +168,29 @@ module Admin::BaseHelper
170
168
  result << '</p>'
171
169
  return result
172
170
  end
173
-
174
- def link_to_published(item)
171
+
172
+ def show_actions item
173
+ html = <<-HTML
174
+ <div class='action' style='margin-top: 10px;'>
175
+ <small>#{link_to _("Edit"), :action => 'edit', :id => item.id}</small> |
176
+ <small>#{link_to_published item}</small> |
177
+ <small>#{link_to _("Delete"), :action => 'destroy', :id => item.id}</small>
178
+ </div>
179
+ HTML
180
+ end
175
181
 
176
- item.published? ? link_to_permalink(item, _("published"), '', 'published') : "<span class='unpublished'>#{_("unpublished")}</span>"
182
+ def format_date(date)
183
+ date.strftime('%d/%m/%Y')
184
+ end
185
+
186
+ def link_to_published(item)
187
+ return link_to_permalink(item, _("Show"), '', 'published') if item.published
188
+ link_to(_("Preview"), {:controller => '/articles', :action => 'preview', :id => item.id}, {:class => 'unpublished', :target => '_new'})
189
+ end
190
+
191
+ def published_or_not(item)
192
+ return "<small class='published'>#{_("Published")}</small>" if item.published
193
+ "<small class='unpublished'>#{_("Unpublished")}</small>"
177
194
  end
178
195
 
179
196
  def macro_help_popup(macro, text)
@@ -0,0 +1,12 @@
1
+ module Admin::CategoriesHelper
2
+ def show_actions item
3
+ html = <<-HTML
4
+ <div class='action' style='margin-top: 10px;'>
5
+ <small>#{link_to_permalink item, pluralize(item.articles.size, _('no articles') , _('1 article'), __('%d articles'))}</small> |
6
+ <small>#{link_to _("Edit"), :action => 'edit', :id => item.id}</small> |
7
+ <small>#{link_to _("Delete"), :action => 'destroy', :id => item.id}</small>
8
+ </div>
9
+ HTML
10
+ end
11
+
12
+ end
@@ -2,4 +2,14 @@ module Admin::FeedbackHelper
2
2
  def comment_class state
3
3
  (state.to_s =~ /Ham/) ? 'published' : 'unpublished'
4
4
  end
5
+
6
+ def show_actions item
7
+ html = <<-HTML
8
+ <div class='action' style='margin-top: 10px;'>
9
+ <small>#{link_to _("Show conversation"), :controller => 'feedback', :action => 'article', :id => item.article_id}</small> |
10
+ <small>#{link_to _("Delete"), :action => 'destroy', :id => item.id}</small>
11
+ </div>
12
+ HTML
13
+ end
14
+
5
15
  end
@@ -179,5 +179,18 @@ module ApplicationHelper
179
179
  def feed_rss
180
180
  url_for(:format => :rss, :only_path => false)
181
181
  end
182
+
183
+ def render_the_flash
184
+ return unless flash[:notice] or flash[:error]
185
+ the_class = flash[:error] ? 'ui-state-error' : 'ui-state-highlight'
186
+ the_icon = flash[:error] ? 'ui-icon-alert' : 'ui-icon-info'
187
+
188
+ html = "<div class='ui-widget settings'>"
189
+ html << "<div class='#{the_class} ui-corner-all' style='padding: 0 .7em;'>"
190
+ html << "<p><span class='ui-icon #{the_icon}' style='float: left; margin-right: .3em;'></span>"
191
+ html << render_flash rescue nil
192
+ html << "</div>"
193
+ html << "</div>"
194
+ end
182
195
 
183
196
  end