Permalink
Browse files

events

  • Loading branch information...
wolas committed Apr 10, 2012
1 parent a5e230a commit 5da7e1ed38487d70c1d9729be8f6a5eb430a748a
Showing with 8 additions and 22 deletions.
  1. +6 −5 app/controllers/events_controller.rb
  2. +1 −1 app/views/events/_form.html.haml
  3. +1 −1 db/schema.rb
  4. +0 −15 html2haml.rb
@@ -13,8 +13,6 @@ def category
def index
#@events = Event.all
@events = Event.paginate(:page => params[:page])
-
-
end
# GET /events/1
@@ -69,14 +67,16 @@ def create
# PUT /events/1
# PUT /events/1.json
def update
+ categories = params[:category_ids] or []
@event = Event.find(params[:id])
@user = @event.user
- @object=@event.id
+ @object = @event.id
+
if @event.cancelled
@content = "cancelled"
@event.approved = true
respond_to do |format|
- if @event.update_attributes(params[:event])
+ if @event.update_attributes(params[:event].merge(:category_ids => categories))
format.html { redirect_to @event, notice: I18n.t(:event_update) }
format.json { head :ok }
else
@@ -89,7 +89,7 @@ def update
@content = "edited"
check_date
respond_to do |format|
- if @event.update_attributes(params[:event])
+ if @event.update_attributes(params[:event].merge(:category_ids => categories))
format.html { redirect_to @event, notice: I18n.t(:event_update) }
format.json { head :ok }
else
@@ -98,6 +98,7 @@ def update
end
end
end
+
end
def resubmit
@@ -16,7 +16,7 @@
= f.label t :event_categories
- Category.all.each do |category|
.field
- = check_box_tag "category_ids[]", category.id
+ = check_box_tag "category_ids[]", category.id, @event.category_ids.include?(category.id)
= category.name
.field
View
@@ -45,7 +45,7 @@
t.integer "event_id"
t.datetime "created_at"
t.datetime "updated_at"
- t.boolean "banned"
+ t.boolean "banned", :default => false
end
add_index "comments", ["event_id"], :name => "index_comments_on_event_id"
View
@@ -1,15 +0,0 @@
-class ConvertToHaml
- def initialize
- @from_path = File.join(File.dirname(__FILE__), 'app', 'views')
- end
-
- def convert!
- Dir["#{@from_path}/**/*.erb"].each do |file|
- puts file
- # for each .erb file in the path, convert it & output to a .haml file
- `bundle exec html2haml -ex #{file} #{file.gsub(/\.erb$/, '.haml')}`
- end
- end
-end
-
-ConvertToHaml.new.convert!

0 comments on commit 5da7e1e

Please sign in to comment.