Permalink
Browse files

changes

  • Loading branch information...
1 parent 064839f commit 7e3b30c18700d64daabbab4452c9ffe5d72e6ff1 @timothyf timothyf committed Jun 10, 2010
Showing with 688 additions and 316 deletions.
  1. +35 −3 app/controllers/admin_controller.rb
  2. +2 −2 app/controllers/pages_controller.rb
  3. +1 −1 app/controllers/users_controller.rb
  4. +10 −0 app/helpers/application_helper.rb
  5. +43 −0 app/models/theme.rb
  6. +10 −0 app/views/admin/_header_nav.html.erb
  7. +36 −0 app/views/admin/contents.html.erb
  8. +78 −0 app/views/admin/modules.html.erb
  9. +0 −84 app/views/admin/pages.html.erb
  10. +13 −29 app/views/admin/themes/_theme.html.erb
  11. +22 −20 app/views/admin/themes/edit.html.erb
  12. +6 −0 app/views/admin/widget_form.html.erb
  13. +80 −0 app/views/layouts/1_col_layout.html.erb
  14. +83 −0 app/views/layouts/2_col_layout.html.erb
  15. +85 −0 app/views/layouts/3_col_layout.html.erb
  16. +1 −1 app/views/layouts/application.html.erb
  17. +0 −17 app/views/layouts/blog_post_topics.html.erb
  18. +0 −17 app/views/layouts/ey_modules.html.erb
  19. +4 −4 app/views/pages/_page_form.html.erb
  20. +34 −29 app/views/shared/_nav_menu.html.erb
  21. +29 −0 app/views/widgets/_widget_form.html.erb
  22. +1 −1 config/routes.rb
  23. +36 −36 lib/tasks/ruby_mi_populate.rake
  24. BIN public/images/{twitter_clone → themes/cms_site_sample}/preview.gif
  25. BIN public/images/{ → themes}/enginey.com/enginey_hdr.jpg
  26. BIN public/images/{ → themes}/enginey.com/preview.jpg
  27. BIN public/images/{ → themes/mycompany}/mycompany_header.jpg
  28. BIN public/images/{ → themes}/mycompany/preview.jpg
  29. BIN public/images/themes/personal_blog/preview.gif
  30. BIN public/images/{ → themes}/rubymi/preview.jpg
  31. BIN public/images/{ → themes/rubymi}/rubymi_header2.jpg
  32. BIN public/images/{personal_blog → themes/simple-jquery}/preview.jpg
  33. BIN public/images/{ → themes}/simple/preview.jpg
  34. BIN public/images/themes/twitter_clone/preview.gif
  35. +34 −2 public/stylesheets/new_admin.css
  36. +1 −1 public/stylesheets/themes/enginey.com/style.css
  37. +1 −1 public/stylesheets/themes/mycompany/mycompany.css
  38. +1 −1 public/stylesheets/themes/rubymi/rubymi.css
  39. +34 −29 themes/mycompany/views/shared/_nav_menu.html.erb
  40. +4 −2 themes/simple-jquery/views/layouts/application.html.erb
  41. +0 −17 themes/simple-jquery/views/layouts/ideas.html.erb
  42. +4 −2 themes/simple/views/layouts/application.html.erb
  43. +0 −17 themes/simple/views/layouts/ideas.html.erb
@@ -46,12 +46,23 @@ def photos
end
- def pages
- @page = 'pages'
+ def contents
+ @page = 'contents'
+ @html_contents = HtmlContent.find(:all)
+ end
+
+
+ def modules
+ @page = 'modules'
@widgets = Widget.find(:all)
@layouts = WidgetLayout.find(:all)
@pages = Page.find(:all)
- @html_contents = HtmlContent.find(:all)
+ end
+
+
+ def pages
+ @page = 'pages'
+ @pages = Page.find(:all)
end
@@ -249,6 +260,27 @@ def content_edit
end
+ def content_delete
+
+ end
+
+
+ def widget_new
+ @widget = Widget.new
+ render 'widget_form'
+ end
+
+
+ def widget_edit
+
+ end
+
+
+ def widget_delete
+
+ end
+
+
def layout_new
@widget_layout = WidgetLayout.new
render 'widget_layout_form'
@@ -15,8 +15,8 @@
class PagesController < ApplicationController
def show
- @page = Page.find_by_title(params[:title])
- @page_name = @page.title
+ @page = Page.find_by_name(params[:name])
+ @page_name = @page.name
if current_user
@user = current_user
end
@@ -188,7 +188,7 @@ def show
respond_to do |format|
format.html {
if (current_user && (current_user.id.to_s == params[:id].to_s))
- @section = 'profile'
+ @section = 'PROFILE'
else
@section = 'MEMBERS'
end
@@ -17,6 +17,16 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
+ # if the user is currently logged in as an admin or creator return true
+ def logged_in_as_admin?
+ if logged_in? && (current_user.roles.include?(Role.creator) || current_user.roles.include?(Role.admin))
+ return true
+ else
+ return false
+ end
+ end
+
+
def display_widget(widget)
if widget.protected == false || logged_in?
render :partial => widget.path, :locals => {:widget=>widget}
View
@@ -0,0 +1,43 @@
+class Theme < ActiveRecord::Base
+
+ def locales
+ Dir[ File.join(RAILS_ROOT, 'themes', self.name, 'locales', '*.{rb,yml}') ]
+ end
+
+ # This method will iterate through all available themes in the theme directory
+ # and then return an array of all themes as well as the currently selected theme
+ # as a hash in the format:
+ # {:name => theme_name, :preview_image => image, :description => description}
+ # This can then be used by the view layer to show the user a list of available themes
+ # along with a preview image.
+ def self.available_themes(selected_theme)
+ themes = []
+ theme_path = File.join(RAILS_ROOT, Disguise::Config.theme_path)
+ current_theme = nil
+
+ Dir.glob("#{theme_path}/*").each do |theme_directory|
+ if File.directory?(theme_directory)
+ theme_name = File.basename(theme_directory)
+
+ image = Dir.glob(File.join(RAILS_ROOT, 'public', 'images/themes', theme_name, 'preview.*')).first || File.join('/', 'images', 'no_preview.gif')
+ image = image.gsub(File.join(RAILS_ROOT, 'public'), '')
+
+ description = ''
+ description_file = File.join(theme_directory, 'description.txt')
+ if File.exist?(description_file)
+ f = File.new(description_file, "r")
+ description = f.read
+ f.close
+ end
+
+ theme = {:name => theme_name, :preview_image => image, :description => description}
+ themes << theme
+
+ current_theme = theme if selected_theme.name == theme_name
+ end
+ end
+
+ [current_theme, themes]
+ end
+
+end
@@ -29,6 +29,16 @@
<% else %>
<li><a href="/admin/forums">Forums</a></li>
<% end %>
+ <% if @page == 'contents' %>
+ <li><a href="/admin/contents" class="active">Content</a></li>
+ <% else %>
+ <li><a href="/admin/contents">Content</a></li>
+ <% end %>
+ <% if @page == 'modules' %>
+ <li><a href="/admin/modules" class="active">Modules</a></li>
+ <% else %>
+ <li><a href="/admin/modules">Modules</a></li>
+ <% end %>
<% if @page == 'pages' %>
<li><a href="/admin/pages" class="active">Pages</a></li>
<% else %>
@@ -0,0 +1,36 @@
+<style>
+ table#pages th, table#pages td, table#widgets th, table#widgets td,
+ table#layouts th, table#layouts td,
+ table#contents th, table#contents td {
+ text-align: left;
+ }
+
+ #content {
+ width: 900px;
+ }
+</style>
+
+<h2 class="ic-db">Managed Content</h2>
+<%= link_to 'Add Content', '/admin/content_new' %>
+<table id="contents">
+ <thead>
+ <th width="50px">ID</th>
+ <th width="100px">Title</th>
+ <th width="300px">Actions</th>
+ </thead>
+ <tbody>
+ <% @html_contents.each do |content| %>
+ <tr>
+ <td><%= content.id %></td>
+ <td><%= content.title %></td>
+ <td>
+ <%= link_to 'Edit', '/admin/content_edit?id=' + content.id.to_s %> |
+ <%= link_to 'Delete', '/admin/content_delete?id=' + content.id.to_s, :confirm => 'Are you sure you want to delete this content?' %> |
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+<% if @html_contents.length == 0 %>
+ No HTML Contents have been created.
+<% end %>
@@ -0,0 +1,78 @@
+<style>
+ table#pages th, table#pages td, table#widgets th, table#widgets td,
+ table#layouts th, table#layouts td,
+ table#contents th, table#contents td {
+ text-align: left;
+ }
+
+ #content {
+ width: 900px;
+ }
+</style>
+
+
+<h2 class="ic-db">Widgets</h2>
+<%= link_to 'Add Widget', '/admin/widget_new' %>
+<table id="widgets">
+ <thead>
+ <th width="50px">ID</th>
+ <th width="160px">Name</th>
+ <th width="100px">Title</th>
+ <th width="100px">Module</th>
+ <th width="300px">Actions</th>
+ </thead>
+ <tbody>
+ <% @widgets.each do |widget| %>
+ <tr>
+ <td><%= widget.id %></td>
+ <td><%= widget.name %></td>
+ <td><%= widget.title %></td>
+ <td><%= widget.ey_module.name %></td>
+ <td>
+ <%= link_to 'Edit', '/admin/widget_edit?id=' + widget.id.to_s %> |
+ <%= link_to 'Delete', '/admin/widget_delete?id=' + widget.id.to_s, :confirm => 'Are you sure you want to delete this widget?' %> |
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<h2 class="ic-db">Layouts</h2>
+Layouts place widgets into specific positions on a page. Selecting all the layouts for a particular
+page will determine the content for that page.<br/><br/>
+<%= link_to 'Add Layout', '/admin/layout_new' %>
+<table id="layouts">
+ <thead>
+ <th width="50px">ID</th>
+ <th width="100px">Page Name</th>
+ <th width="140px">Widget Name</th>
+ <th width="70px">Col Num</th>
+ <th width="70px">Row Num</th>
+ <th width="100px">HTML Content</th>
+ <th width="300px">Actions</th>
+ </thead>
+ <tbody>
+ <% @layouts.each do |layout| %>
+ <tr>
+ <td><%= layout.id %></td>
+ <% if layout.page %>
+ <td><%= layout.page.name %></td>
+ <% else %>
+ <td>null</td>
+ <% end %>
+ <td><%= layout.widget.name %></td>
+ <td><%= layout.col_num %></td>
+ <td><%= layout.row_num %></td>
+ <% if layout.html_content %>
+ <td><%= link_to layout.html_content.title, '' %></td>
+ <% else %>
+ <td></td>
+ <% end %>
+ <td>
+ <%= link_to 'Edit', '/admin/layout_edit?id=' + layout.id.to_s %> |
+ <%= link_to 'Delete', '/admin/layout_delete?id=' + layout.id.to_s, :confirm => 'Are you sure you want to delete this layout?' %> |
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
@@ -36,87 +36,3 @@
</table>
-<h2 class="ic-db">Widgets</h2>
-<%= link_to 'Add Widget', '/admin/widget_new' %>
-<table id="widgets">
- <thead>
- <th width="50px">ID</th>
- <th width="160px">Name</th>
- <th width="100px">Title</th>
- <th width="300px">Actions</th>
- </thead>
- <tbody>
- <% @widgets.each do |widget| %>
- <tr>
- <td><%= widget.id %></td>
- <td><%= widget.name %></td>
- <td><%= widget.title %></td>
- <td>
- <%= link_to 'Edit', '/admin/widget_edit?id=' + widget.id.to_s %> |
- <%= link_to 'Delete', '/admin/widget_delete?id=' + widget.id.to_s, :confirm => 'Are you sure you want to delete this widget?' %> |
- </td>
- </tr>
- <% end %>
- </tbody>
-</table>
-
-<h2 class="ic-db">Layouts</h2>
-Layouts place widgets into specific positions on a page. Selecting all the layouts for a particular
-page will determine the content for that page.<br/><br/>
-<%= link_to 'Add Layout', '/admin/layout_new' %>
-<table id="layouts">
- <thead>
- <th width="50px">ID</th>
- <th width="100px">Page Name</th>
- <th width="140px">Widget Name</th>
- <th width="70px">Col Num</th>
- <th width="70px">Row Num</th>
- <th width="75px">HTML Content ID</th>
- <th width="300px">Actions</th>
- </thead>
- <tbody>
- <% @layouts.each do |layout| %>
- <tr>
- <td><%= layout.id %></td>
- <% if layout.page %>
- <td><%= layout.page.name %></td>
- <% else %>
- <td>null</td>
- <% end %>
- <td><%= layout.widget.name %></td>
- <td><%= layout.col_num %></td>
- <td><%= layout.row_num %></td>
- <td><%= layout.html_content_id %></td>
- <td>
- <%= link_to 'Edit', '/admin/layout_edit?id=' + layout.id.to_s %> |
- <%= link_to 'Delete', '/admin/layout_delete?id=' + layout.id.to_s, :confirm => 'Are you sure you want to delete this layout?' %> |
- </td>
- </tr>
- <% end %>
- </tbody>
-</table>
-
-<h2 class="ic-db">Contents</h2>
-<%= link_to 'Add Content', '/admin/content_new' %>
-<table id="contents">
- <thead>
- <th width="50px">ID</th>
- <th width="100px">Title</th>
- <th width="300px">Actions</th>
- </thead>
- <tbody>
- <% @html_contents.each do |content| %>
- <tr>
- <td><%= content.id %></td>
- <td><%= content.title %></td>
- <td>
- <%= link_to 'Edit', '/admin/content_edit?id=' + content.id.to_s %> |
- <%= link_to 'Delete', '/admin/content_delete?id=' + content.id.to_s, :confirm => 'Are you sure you want to delete this content?' %> |
- </td>
- </tr>
- <% end %>
- </tbody>
-</table>
-<% if @html_contents.length == 0 %>
- No HTML Contents have been created.
-<% end %>
Oops, something went wrong.

0 comments on commit 7e3b30c

Please sign in to comment.