Permalink
Browse files

Station Refactorization

  • Loading branch information...
1 parent 9ff220d commit 5a4247f2df70e0611ce0b53e803de2926c0edf84 @atd atd committed May 6, 2009
Showing with 1,548 additions and 2,788 deletions.
  1. +34 −50 README.rdoc
  2. +1 −1 Rakefile
  3. +0 −2 app/controllers/sites_controller.rb
  4. +0 −67 app/helpers/application_helper.rb
  5. +0 −8 app/helpers/categories_helper.rb
  6. +0 −80 app/helpers/contents_helper.rb
  7. +0 −132 app/helpers/logos_helper.rb
  8. +0 −54 app/helpers/menu_box_helper.rb
  9. +0 −11 app/helpers/resources_helper.rb
  10. +0 −62 app/helpers/sortable_helper.rb
  11. +0 −9 app/helpers/stages_helper.rb
  12. +0 −15 app/helpers/tags_helper.rb
  13. +0 −7 app/models/attachment.rb
  14. +3 −0 app/models/post.rb
  15. +0 −7 app/models/xhtml_text.rb
  16. +37 −87 app/views/layouts/application.html.erb
  17. +31 −16 app/views/layouts/sessions.html.erb
  18. +27 −18 app/views/sessions/new.html.erb
  19. +8 −8 app/views/sites/show.html.erb
  20. +0 −76 app/views/stages/_performances_form.html.erb
  21. +6 −3 { → config}/locales/en.yml
  22. +5 −2 { → config}/locales/es.yml
  23. +70 −0 config/routes.rb
  24. +0 −19 db/migrate/002_post_to_entry.rb
  25. +0 −44 db/migrate/003_permissions_roles.rb
  26. +0 −22 db/migrate/004_logoables.rb
  27. +0 −14 db/migrate/005_singular_agents.rb
  28. +0 −26 db/migrate/006_powered_categories.rb
  29. +0 −17 db/migrate/007_openid_server.rb
  30. +0 −21 db/migrate/008_create_invitations.rb
  31. +0 −24 db/migrate/009_drop_entries.rb
  32. +0 −16 generators/agent/templates/model_controller.rb
  33. +0 −12 generators/cms/cms_generator.rb
  34. +0 −10 generators/content/templates/controller.rb
  35. +0 −8 generators/content/templates/form.erb
  36. +0 −3 generators/content/templates/new.html.erb
  37. +2 −2 generators/{cms → station}/USAGE
  38. +6 −6 generators/{cms → station}/rails_commands.rb
  39. +25 −0 generators/station/station_generator.rb
  40. +93 −67 db/migrate/001_init.rb → generators/station/templates/migration.rb
  41. 0 generators/{cms → station}/templates/public/403.html
  42. BIN generators/station/templates/public/images/models/16/site.png
  43. BIN generators/station/templates/public/images/models/96/site.png
  44. +314 −0 generators/station/templates/public/stylesheets/LICENSE
  45. +26 −0 generators/station/templates/public/stylesheets/ie.css
  46. +30 −0 generators/station/templates/public/stylesheets/print.css
  47. +251 −0 generators/station/templates/public/stylesheets/screen.css
  48. +1 −0 generators/station/templates/public/stylesheets/style.css
  49. 0 generators/{agent → station_agent}/MIT-LICENSE
  50. 0 generators/{agent → station_agent}/USAGE
  51. +23 −22 generators/{agent/agent_generator.rb → station_agent/station_agent_generator.rb}
  52. 0 generators/{agent → station_agent}/templates/fixtures.yml
  53. 0 generators/{agent → station_agent}/templates/functional_spec.rb
  54. 0 generators/{agent → station_agent}/templates/functional_test.rb
  55. 0 generators/{agent → station_agent}/templates/helper.rb
  56. 0 generators/{agent → station_agent}/templates/lost_password.html.erb
  57. +1 −1 generators/{agent → station_agent}/templates/mailer.rb
  58. 0 generators/{agent → station_agent}/templates/mailer_activation.text.plain.erb
  59. 0 generators/{agent → station_agent}/templates/mailer_lost_password.text.plain.erb
  60. 0 generators/{agent → station_agent}/templates/mailer_reset_password.text.plain.erb
  61. 0 generators/{agent → station_agent}/templates/mailer_signup_notification.text.plain.erb
  62. 0 generators/{agent → station_agent}/templates/mailer_test.rb
  63. generators/{agent → station_agent}/templates/migration.rb
  64. 0 generators/{agent → station_agent}/templates/model.rb
  65. +5 −0 generators/station_agent/templates/model_controller.rb
  66. 0 generators/{agent → station_agent}/templates/model_functional_spec.rb
  67. 0 generators/{agent → station_agent}/templates/model_functional_test.rb
  68. 0 generators/{agent → station_agent}/templates/model_helper.rb
  69. +4 −1 generators/{agent → station_agent}/templates/observer.rb
  70. 0 generators/{agent → station_agent}/templates/reset_password.html.erb
  71. 0 generators/{agent → station_agent}/templates/show.atomsvc.builder
  72. 0 generators/{agent → station_agent}/templates/show.html.erb
  73. 0 generators/{agent → station_agent}/templates/show.xrds.builder
  74. 0 generators/{agent → station_agent}/templates/signup.html.erb
  75. +3 −3 generators/{agent → station_agent}/templates/unit_spec.rb
  76. +2 −2 generators/{agent → station_agent}/templates/unit_test.rb
  77. +5 −4 generators/{content/content_generator.rb → station_scaffold/station_scaffold_generator.rb}
  78. +8 −0 generators/station_scaffold/templates/controller.rb
  79. +9 −0 generators/station_scaffold/templates/edit.html.erb
  80. +9 −0 generators/station_scaffold/templates/form.erb
  81. 0 generators/{content → station_scaffold}/templates/functional_test.rb
  82. 0 generators/{content → station_scaffold}/templates/helper.rb
  83. 0 generators/{content → station_scaffold}/templates/index.atom.builder
  84. +1 −1 generators/{content → station_scaffold}/templates/index.html.erb
  85. +1 −1 generators/{content → station_scaffold}/templates/model.rb
  86. +9 −0 generators/station_scaffold/templates/new.html.erb
  87. 0 generators/{content → station_scaffold}/templates/partial.atom.builder
  88. 0 generators/{content → station_scaffold}/templates/show.erb
  89. 0 generators/{content → station_scaffold}/templates/show.html.erb
  90. +43 −15 init.rb
  91. +1 −1 install.rb
  92. +21 −68 lib/action_controller/agents.rb
  93. +18 −0 lib/action_controller/agents/activation.rb
  94. +40 −0 lib/action_controller/agents/password_reset.rb
  95. +1 −1 lib/action_controller/logos.rb
  96. +25 −42 lib/action_controller/{move.rb → station.rb}
  97. +10 −7 lib/action_controller/{move_resources.rb → station_resources.rb}
  98. +12 −0 lib/action_view/helpers/categories_helper.rb
  99. +133 −0 lib/action_view/helpers/logos_helper.rb
  100. +66 −0 lib/action_view/helpers/sortable_helper.rb
  101. +63 −0 lib/action_view/helpers/station_helper.rb
  102. +19 −0 lib/action_view/helpers/tags_helper.rb
  103. +4 −0 lib/active_record/agent.rb
  104. +4 −32 lib/active_record/agent/activation.rb
  105. +37 −0 lib/active_record/agent/password_reset.rb
  106. +0 −30 lib/{move → station}/core_ext.rb
  107. BIN public/images/models/anonymous_agent.png
  108. BIN public/images/models/application-pdf.png
  109. BIN public/images/models/article.png
  110. BIN public/images/models/image-gif.png
  111. BIN public/images/models/image-jpeg.png
  112. BIN public/images/models/image-png.png
  113. BIN public/images/models/image.png
  114. BIN public/images/models/site.png
  115. BIN public/images/models/space.png
  116. BIN public/images/models/user.png
  117. BIN public/images/move_css/add.png
  118. BIN public/images/move_css/ardeia.png
  119. BIN public/images/move_css/article_icon_small.png
  120. BIN public/images/move_css/article_icon_thumb.png
  121. BIN public/images/move_css/audios_icon_small.png
  122. BIN public/images/move_css/background_agent_content_unit.png
  123. BIN public/images/move_css/background_agent_content_unit_active.png
  124. BIN public/images/move_css/background_agent_content_unit_hover.png
  125. BIN public/images/move_css/background_agent_view.png
  126. BIN public/images/move_css/background_body.gif
  127. BIN public/images/move_css/background_box_content_unit.png
  128. BIN public/images/move_css/background_box_content_unit_active.png
  129. BIN public/images/move_css/background_box_content_unit_hover.png
  130. BIN public/images/move_css/background_box_view.png
  131. BIN public/images/move_css/background_content_class_active_down.png
  132. BIN public/images/move_css/background_content_class_active_top.png
  133. BIN public/images/move_css/background_content_class_down.png
  134. BIN public/images/move_css/background_content_info_bottom.png
  135. BIN public/images/move_css/background_content_info_top.png
  136. BIN public/images/move_css/background_content_link_active.png
  137. BIN public/images/move_css/background_content_link_alternative.png
  138. BIN public/images/move_css/background_content_link_inactive.png
  139. BIN public/images/move_css/background_content_link_inactive_hover.png
  140. BIN public/images/move_css/background_content_unit.png
  141. BIN public/images/move_css/background_content_unit_active.png
  142. BIN public/images/move_css/background_detail_title.png
  143. BIN public/images/move_css/background_detail_view.png
  144. BIN public/images/move_css/background_error_explanation.png
  145. BIN public/images/move_css/background_footer.png
  146. BIN public/images/move_css/background_interaction_screen_bottom.png
  147. BIN public/images/move_css/background_interaction_screen_center.png
  148. BIN public/images/move_css/background_interaction_screen_top.png
  149. BIN public/images/move_css/background_interaction_title.png
  150. BIN public/images/move_css/background_login_button.png
  151. BIN public/images/move_css/background_login_button_hover.png
  152. BIN public/images/move_css/background_logo.png
  153. BIN public/images/move_css/background_logo_public_contents.png
  154. BIN public/images/move_css/background_logo_wrap.png
  155. BIN public/images/move_css/background_menu_agent_top.png
  156. BIN public/images/move_css/background_menu_box_top.png
  157. BIN public/images/move_css/background_menu_content_bottom.png
  158. BIN public/images/move_css/background_menu_content_top.png
  159. BIN public/images/move_css/background_session_top.png
  160. BIN public/images/move_css/bookmark_icon_small.png
  161. BIN public/images/move_css/box_arrow_left.png
  162. BIN public/images/move_css/box_arrow_left_in_move.gif
  163. BIN public/images/move_css/box_arrow_left_in_move.png
  164. BIN public/images/move_css/box_arrow_right.png
  165. BIN public/images/move_css/box_arrow_right_in_move.png
  166. BIN public/images/move_css/config.png
  167. BIN public/images/move_css/config_hover.png
  168. BIN public/images/move_css/config_logo.png
  169. BIN public/images/move_css/contents_separator.png
  170. BIN public/images/move_css/delete.png
  171. BIN public/images/move_css/document_icon_small.png
  172. BIN public/images/move_css/edit.png
  173. BIN public/images/move_css/error.png
  174. BIN public/images/move_css/group.png
  175. BIN public/images/move_css/info.png
  176. BIN public/images/move_css/logout.png
  177. BIN public/images/move_css/logout_hover.png
  178. BIN public/images/move_css/map_icon_small.png
  179. BIN public/images/move_css/permission.png
  180. BIN public/images/move_css/photo_icon_small.png
  181. BIN public/images/move_css/user.png
  182. BIN public/images/move_css/view.png
  183. BIN public/images/move_dynamic.gif
  184. BIN public/images/move_static.png
  185. BIN public/images/notification_area/error.png
  186. BIN public/images/notification_area/success.png
  187. BIN public/images/sortable/asc.png
  188. BIN public/images/sortable/asc_active.png
  189. BIN public/images/sortable/desc.png
  190. BIN public/images/sortable/desc_active.png
  191. +0 −265 public/javascripts/move.js
  192. +0 −4 public/stylesheets/actions.css
  193. +0 −21 public/stylesheets/agents.css
  194. +0 −19 public/stylesheets/containers.css
  195. +0 −182 public/stylesheets/contents.css
  196. +0 −19 public/stylesheets/footer.css
  197. +0 −41 public/stylesheets/form.css
  198. +0 −107 public/stylesheets/login.css
  199. +0 −45 public/stylesheets/logo.css
  200. +0 −101 public/stylesheets/meta.css
  201. +0 −556 public/stylesheets/move.css
  202. +0 −11 public/stylesheets/notification_area.css
  203. +0 −26 public/stylesheets/session.css
  204. +0 −64 public/stylesheets/sortable.css
  205. +0 −69 routes.rb
View
@@ -1,42 +1,21 @@
-= Content Management System plugin
+= Station
-CMSplugin is to {Rails}[http://rubyonrails.org/] in Content Management like
+Station is to {Rails}[http://rubyonrails.org/] in Content Management System like
{Rails}[http://rubyonrails.org/] is to {Ruby}[http://www.ruby-lang.org/] in Web Development.
- Rails = Ruby + Web Development
- CMSplugin = Rails + Content Management
+ Rails = Ruby + Web Development
+ Station = Rails + Content Management
-CMSplugin provides your Rails application with a "CMS framework". That means authentication, authorization, roles, permissions, categories, tags, etc... but from a very flexible scope.
+Station provides your Rails application with a "CMS framework". That means authentication, authorization, roles, permissions, categories, tags, etc... but from a very flexible scope.
-CMSplugin follows the SIOC ontology model, http://sioc-project.org/ontology
-
-Project page: http://rubyforge.org/projects/cmsplugin
-
-Documentation: http://cmsplugin.rubyforge.org/
-
-== Architecture
-
-You can add this functionality to any of your ActiveRecord models:
-
-=== Basic
-ActiveRecord::Resource:: a model that have, at least, {CRUD}[http://en.wikipedia.org/wiki/Create,_read,_update_and_delete] operations and can be imported/exported in different formats.
-ActiveRecord::Content:: a Resource that belongs to a Container.
-ActiveRecord::Container:: a model that have many Contents.
-ActiveRecord::Agent:: a model with authentication, authorization and potencial to perform actions over Resources.
-ActiveRecord::Stage:: a model that defines an Authorization framework for Agents.
-
-=== Complements
-ActiveRecord::CategoriesDomain:: a model which instances define Ontology domains
-ActiveRecord::Categorizable:: a model that can be classified in any Category
-ActiveRecord::Taggable:: a model that can be tagged
-ActiveRecord::Logoable:: a model with Logo
-ActiveRecord::Sortable:: a model with a sortable list
+Station follows the SIOC ontology model, http://sioc-project.org/ontology
+http://github.com/atd/station
== Features
* Authentication: Login/Password, {OpenID}[http://openid.net/], {Central Authentication Service (CAS)}[http://www.ja-sig.org/products/cas/], CookieToken
-* Authorization: Roles and Permissions
+* Authorization: Affordances, Roles and Permissions
* Activation: Email validation, Password reset
* Atom feeds, {RFC 4287}[http://tools.ietf.org/html/rfc4287]
* AtomPub protocol, {RFC 5023}[http://tools.ietf.org/html/rfc5023]
@@ -48,64 +27,69 @@ ActiveRecord::Sortable:: a model with a sortable list
== Requirements
-* Rails 2.2.2
+* Rails 2.3.2
* RubyGems:
* ruby-openid
* atom-tools
* hpricot
* mislav-will_paginate
- * atd-calendar_date_select
* Rails Plugins:
- * engines
* attachment_fu
+ * exception_notification (optional)
== Installation
=== Plugins
-You need Rails Engines first:
- script/plugin install git://github.com/atd/engines.git
-see vendor/plugins/engines/README to finish the instalation (don't forget to modify config/environment.rb)
+You need attachment_fu for Logos and Attachments:
+ script/plugin install git://github.com/atd/attachment_fu.git
-To install CMSplugin, run:
- script/plugin install git://github.com/atd/cmsplugin.git
+To install Station, run:
+ script/plugin install git://github.com/atd/station.git
-Install exception_notification plugin if you want to receive debug emails
+Install exception_notification plugin if you want to receive debugging emails from your application
script/plugin install git://github.com/rails/exception_notification.git
=== Gems
Run rake gems:install to install the required gems
-=== CMS
+== Architecture
-Generate the CMS infraestructure:
- script/generate cms
+You can add this functionality to any of your ActiveRecord models:
-And generate and run the migration:
- script/generate plugin_migration
+=== Basic
+ActiveRecord::Resource:: a model that have, at least, {CRUD}[http://en.wikipedia.org/wiki/Create,_read,_update_and_delete] operations and can be imported/exported in different formats.
+ActiveRecord::Content:: a Resource that belongs to a Container, e.g. a Post
+ActiveRecord::Container:: a model that have many Contents, e.g. a Space
+ActiveRecord::Agent:: a model with authentication, authorization and potencial to perform actions over Resources, e.g. a User
+ActiveRecord::Stage:: a model that defines an Authorization framework for Agents, e.g. a Group
-Now you can generate Agents and Contents.
+=== Complements
+ActiveRecord::CategoriesDomain:: a model which instances define Ontology domains
+ActiveRecord::Categorizable:: a model that can be classified in any Category
+ActiveRecord::Taggable:: a model that can be tagged
+ActiveRecord::Logoable:: a model with Logo
+ActiveRecord::Sortable:: a model with a sortable list
== Generators
=== Agents
An Agent has the capability to post Contents to Containers. An User is the example of Agent
- script/generate agent Model
+ script/generate station_agent Model
-=== Contents
-A Content is a piece of information suitable to be posted to some Container by some Agent
+=== Resources
- script/generate content Model attributes
+ script/generate station_scaffold Model attributes
== Example
=== Blog
Create personal blogs with a pair of commands:
- script/generate agent User
- script/generate content Article body:text
+ script/generate station_agent User
+ script/generate station_resource Article content:text
Users now can entry their own Articles
View
@@ -15,7 +15,7 @@ end
desc 'Generate documentation for the cms plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'CMSplugin'
+ rdoc.title = 'Station'
rdoc.template = 'doc/template/horo.rb'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.rdoc')
@@ -4,8 +4,6 @@ class SitesController < ApplicationController
# GET /site.xml
def show
@site = current_site
- @agents = ActiveRecord::Agent.authentication_classes.map(&:all).flatten.uniq.sort{ |x, y| x.name <=> y.name }
- @containers = ( ActiveRecord::Container.classes - ActiveRecord::Agent.classes).map(&:all).flatten.uniq.sort{ |x, y| x.name <=> y.name }
end
# GET /site/new
@@ -1,67 +0,0 @@
-# Methods added to this helper will be available to all templates in the application.
-module ApplicationHelper
- include ResourcesHelper
- include ContentsHelper
- include MenuBoxHelper
- include SortableHelper
- include StagesHelper
- include TagsHelper
- include LogosHelper
-
- # Get title in this order:
- # 1. string argument
- # 2. @title instance variable
- # 3. Title based on variables set by the Controller
- # 4. <tt>controller.controller_name</tt> - <tt>site.name</tt>
- #
- # Options:
- # <tt>append_site_name</tt>:: Append the Site name to the title, ie, "Title - Example Site". Defaults to <tt>false</tt>
- #
- def title(new_title = "", options = {})
- title = if new_title.present?
- new_title.dup
- elsif @title
- @title
- elsif @contents
- container ?
- t(:other_in_container, :scope => controller.controller_name.singularize, :container => container.name) :
- t(:other, :scope => controller.controller_name.singularize)
- elsif @resources
- t(:other, :scope => controller.controller_name.singularize)
- elsif @resource
- if @resource.new_record?
- t(:new, :scope => @resource.class.to_s.underscore)
- elsif controller.action_name == 'edit' || @resource.errors.any?
- t(:editing, :scope => @resource.class.to_s.underscore)
- else
- @resource.title
- end
- else
- controller.controller_name.titleize
- end
- title << " - #{ site.name }" if options[:append_site_name]
-
- sanitize(title)
- end
-
- # Renders notification_area div if there is a flash entry for types:
- # <tt>:valid</tt>, <tt>:error</tt>, <tt>:warning</tt>, <tt>:info</tt>, <tt>:notice</tt> and <tt>:success</tt>
- def notification_area
- returning '<div id="notification_area">' do |html|
- for type in %w{ valid error warning info notice success}
- next if flash[type.to_sym].blank?
- html << "<div class=\"#{ type }\">#{ flash[type.to_sym] }</div>"
- end
- html << "</div>"
- end
- end
-
- # Prints an atom <tt>link</tt> header for feed autodiscovery.
- # Use it in partials:
- # atom_link(container, Content.new)
- # You must have <tt>yield(:headers)</tt> in your layout
- def atom_link_header(*args)
- content_for :headers, "<link href=\"#{ polymorphic_url(args) }.atom\" rel=\"alternate\" title=\"#{ title }\" type=\"application/atom+xml\" />"
- end
-end
-
@@ -1,8 +0,0 @@
-module CategoriesHelper
- # Return a list of linked Categories, separated by <tt>,</tt>
- def categories_list(item)
- item.categories.map{ |c|
- link_to c.name, polymorphic_path([ c.domain, c ])
- }.join(', ')
- end
-end
@@ -1,80 +0,0 @@
-module ContentsHelper
-
- # Separator
- def contents_menu_separator
- '<hr class="separator" />'
- end
-
- # Menu for container contents
- #
- # Options:
- # container:: Set to false it ignores the container
- def contents_menu(options = {})
- options[:contents] ||= contents_list(options)
- options[:container] = true if options[:container].nil?
- container = options[:container] ? self.container : nil
-
- returning "" do |menu|
- options[:contents].each do |content|
- content_link = polymorphic_path([ container, content.to_class.new ])
- menu << link_to("<span id=\"content_link_#{ content.to_s.tableize }\"> » #{ t(content.to_s.singularize, :count => :other) } </span>", content_link, {:class => "content_link #{ controller.controller_name == content.to_s.pluralize ? "active" : "inactive" } button" })
- end
- end
- end
-
- def new_content_button
- logger.debug "DEPRECATION WARNING: new_content_button is deprecated. Use new_contents_menu"
- new_contents_menu
- end
-
- # Display buttons for add contents to current_container
- def new_contents_menu(options = {})
- options[:contents] ||= contents_list(options)
- options[:container] = true if options[:container].nil?
- container = options[:container] ? self.container : nil
-
- returning "" do |html|
- html << "<div id=\"content_new_top\" class=\"block_white_top\"#{ t('create_') } </div>"
- html << "<div id=\"content_new_center\" class=\"block_white_center\">"
-
- options[:contents].each do |content|
- html << link_to(t(:new, :scope => content.to_s.singularize),
- new_polymorphic_path([ container,
- content.to_class.new ]),
- {:class => "action add" })
- end
-
- html << "</div>"
- html << "<div id=\"content_new_bottom\" class=\"block_white_bottom\"></div><br />"
- end
- end
-
- # List of contents available for this view
- #
- # Options:
- # container:: Set to false it ignores the container
- #
- def contents_list(options = {})
- options[:container] ||= true
-
- ( options[:container] && container ?
- container.class.contents :
- ActiveRecord::Content.symbols
- ).sort { |a, b|
- t(a.to_s.singularize, :count => :other) <=>
- t(b.to_s.singularize, :count => :other)
- }
- end
-
- # Show info about the Content
- def content_info(content = nil)
- content ||= @content
-
- returning "" do |html|
- html << "<div id=\"content_info_top\" class=\"block_white_top\"#{ t('detail.other') } </div>"
- html << "<div id=\"content_info_center\" class=\"block_white_center\">#{ render(:partial => "contents/info", :locals => { :content => content } ) if content }</div>"
- html << "<div id=\"content_info_bottom\" class=\"block_white_bottom\"></div>"
- end
- end
-end
-
Oops, something went wrong.

0 comments on commit 5a4247f

Please sign in to comment.