Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

changed ansuz from a class to a module. fixed setting roles on users.…

… prettied up site settings index a bit.
  • Loading branch information...
Josh Adams
Josh Adams committed Nov 16, 2008
1 parent 46ecd79 commit c8a2f73fcca75125a4f4f2ebbc21d21b9930bd2a
@@ -11,4 +11,8 @@ class Role < ActiveRecord::Base
STATIC_ROLES = ["admin", "content_owner", "initial_reviewer", "final_reviewer", "author"]

named_scope :root, :conditions => "authorizable_type IS NULL and authorizable_id IS NULL"

def self.base_roles
(root.find(:all).map(&:name) + STATIC_ROLES).uniq
end
end
@@ -5,5 +5,5 @@
<% end -%>
<table class='form-table'>
<%= form_row "Site Title", @settings.site_title -%>
<%= form_row "User Theme", @settings.get_theme_setting + " " + link_to("(change)", choose_theme_admin_site_settings_path) -%>
<%= form_row "User Theme", "<img src='#{fetch_theme_preview_admin_site_settings_path(:id => @settings.get_theme_setting)}' alt='#{@settings.get_theme_setting}' />" + "<br />" + @settings.get_theme_setting + " " + link_to("(change)", choose_theme_admin_site_settings_path) -%>
</table>
@@ -1,4 +1,4 @@
class Ansuz
module Ansuz
class PluginManager
attr_accessor :plugins, :plugin_nav, :admin_plugin_nav, :admin_menu, :admin_menu_top_level_entries, :page_types
ADMIN_MENU_TOP_LEVEL_ENTRIES = ["Content", "Add-ons", "Themes", "Ansuz"]
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class BlogComment < ActiveRecord::Base
belongs_to :blog_post, :class_name => "Ansuz::JAdams::BlogPost"
end
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class BlogPost < ActiveRecord::Base
acts_as_taggable
belongs_to :author, :class_name => "User", :foreign_key => 'created_by'
@@ -1,8 +1,6 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class ContentSection < ActiveRecord::Base
#version_fu :table_name => 'content_section_versions'

def self.admin_partial
"/content_sections/edit"
end
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class MenuEntry < ActiveRecord::Base
acts_as_tree :order => 'position'
def self.root_entries
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class PhotoAlbum < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
@@ -1,6 +1,6 @@
require 'paperclip'
class Ansuz
class JAdams
module Ansuz
module JAdams
class PhotoAlbumPhoto < ActiveRecord::Base
belongs_to :photo_album, :class_name => "Ansuz::JAdams::PhotoAlbum"
has_attached_file :photo_album_photo_image,
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class ScrollableContent < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class ScrollableContentSection < ActiveRecord::Base
belongs_to :scrollable_content, :class_name => "Ansuz::JAdams::ScrollableContent"
end
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class Testimonial < ActiveRecord::Base
def self.random
if count > 0
@@ -1,5 +1,5 @@
class Ansuz
class JAdams
module Ansuz
module JAdams
class AnsuzTheme < ActiveRecord::Base
validates_uniqueness_of :name
end
@@ -1,6 +1,6 @@
require 'open-uri'
class Ansuz
class JAdams
module Ansuz
module JAdams
class AnsuzThemesListing
REPOSITORY = "http://ansuzcms.com/ansuz_themes.xml"

This file was deleted.

@@ -41,6 +41,14 @@ def edit

def update
if @user.update_attributes(params[:user])
Role.base_roles.each do |role|
if params[:roles].include?(role)
@user.has_role(role)
else
@user.has_no_role(role)
end
end

flash[:notice] = "User was updated successfully."
redirect_to admin_users_path
else
@@ -6,7 +6,7 @@
<%= form_row "Confirm Password", f.password_field(:password_confirmation) %>
<%= form_row "Email", f.text_field(:email) %>
<%= form_row "Admin?", f.check_box(:admin) %>
<%= form_row "Roles", select_tag("roles[]", options_for_select(Role::STATIC_ROLES, @user.roles.map(&:name)), { :multiple => true, :size => 6 }), :note => "ctrl+click to select multiple." %>
<%= form_row "Roles", select_tag("roles[]", options_for_select(Role.base_roles, @user.roles.map(&:name)), { :multiple => true, :size => 6 }), :note => "ctrl+click to select multiple." %>
</table>
<br />
<%= submit_tag submit_text -%> or <%= link_to "Cancel", admin_users_path -%>

0 comments on commit c8a2f73

Please sign in to comment.
You can’t perform that action at this time.