Permalink
Browse files

Solving problem with jammit and rails 3.1

  • Loading branch information...
adrianotadao committed Aug 15, 2011
1 parent a5be42b commit 00c60ea5f254873f9981db7af645d1c4a984c240
View
@@ -10,13 +10,19 @@ gem 'sass', '3.1.4'
gem 'rails3-generators', '0.17.4'
-gem 'jquery-rails', '1.0.12'
gem 'simple_form', '1.4.2'
+gem 'jammit', '0.6.3'
+gem 'yui-compressor', '0.9.6'
+gem 'closure-compiler', '1.1.1'
+
gem 'settingslogic', '2.0.6'
gem 'friendly_id', '3.2.1.1'
+gem 'devise', '1.4.2'
+gem 'warden', '1.0.4'
+
group :development do
gem "haml-rails", '0.3.4'
end
@@ -4,6 +4,6 @@
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
-//= require jquery
-//= require jquery_ujs
+= require jquery
+= require jquery_ujs
//= require_tree .
@@ -0,0 +1,50 @@
+class BlogsController < ApplicationController
+ def index
+ @blogs = Blog.all
+ end
+
+ def show
+ @blog = Blog.find params[:id]
+ end
+
+ def new
+ @blog = Blog.new
+ end
+
+ def edit
+ @blog = Blog.find params[:id]
+ end
+
+ def create
+ @blog = Blog.new(params[:blog])
+ if @blog.save
+ flash[:notice] = "Blog salvo com sucesso!"
+ redirect_to :action => 'index'
+ else
+ flash.now[:error] = "Verifique se todos os campos foram preenchidos corretamente."
+ render :action => 'new'
+ end
+ end
+
+ def update
+ @blog = Blog.find(params[:id])
+ if @blog.update_attributes(params[:brand])
+ flash[:notice] = "Blog alterado com sucesso!"
+ redirect_to :action=>'index'
+ else
+ flash.now[:error] = "Verifique se todos os campos foram preenchidos corretamente."
+ render :action => 'edit'
+ end
+ end
+
+ def destroy
+ @blog = Blog.find(params[:id])
+ if @blog.destroy
+ flash[:notice] = "Blog deletado com sucesso!"
+ else
+ flash.now[:error] = "Verifique se o blog #{@blog.author} realmente pode ser deletada."
+ end
+ redirect_to :action => 'index'
+ end
+
+end
View
@@ -0,0 +1,2 @@
+class Blog < ActiveRecord::Base
+end
@@ -0,0 +1,2 @@
+class Configuration < ActiveRecord::Base
+end
View
@@ -0,0 +1,4 @@
+class Karma < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :post
+end
@@ -0,0 +1,4 @@
+class Moderatorship < ActiveRecord::Base
+ belongs_to :forum
+ belongs_to :user
+end
View
@@ -0,0 +1,5 @@
+class Post < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :topic
+ belongs_to :forum
+end
View
@@ -0,0 +1,3 @@
+class Prashe < ActiveRecord::Base
+ belongs_to :user
+end
View
@@ -0,0 +1,4 @@
+class Topic < ActiveRecord::Base
+ belongs_to :forum
+ belongs_to :user
+end
@@ -0,0 +1,22 @@
+= simple_form_for @blog do |f|
+ - if @blog.errors.any?
+ #error_explanation
+ .errors
+ = pluralize(@blog.errors.count, "erros")
+ foram encontrados:
+
+ %ul
+ - @blog.errors.full_messages.each do |msg|
+ %li= msg
+ .inputs
+ = f.input :restricted, :as => :radio
+ = f.input :url
+ = f.input :rss
+ = f.input :author
+ = f.input :avatar
+ = f.input :comment_expression
+
+ .actions
+ = f.button :submit, 'Save'
+ - unless @blog.new_record?
+ = link_to 'Deletar', blog_path(@blog), :confirm => 'Deseja realmente deletar?', :method => :delete, :class => 'delete'
@@ -0,0 +1,3 @@
+%h1 Editing
+
+= render 'form'
@@ -0,0 +1,17 @@
+%h1 Blogs
+
+= link_to 'New blog', new_blog_path
+
+- unless @blogs.blank?
+ %table
+ %thead
+ %tr
+ %th Author
+ %th.actions
+ %tbody
+ - for blog in @blogs
+ %tr
+ %td= blog.author
+ %td.actions
+ = link_to 'Edit', edit_blog_path(blog)
+ = link_to 'Show', blog_path(blog)
@@ -0,0 +1,3 @@
+%h1 New blog
+
+= render 'form'
No changes.
@@ -14,5 +14,6 @@
%body
= yield
-
+
+ = include_javascripts :forum
= yield :javascript
View
@@ -0,0 +1,7 @@
+javascripts:
+ forum:
+ - app/assets/javascripts/application.js
+
+stylesheets:
+ forum:
+ - public/stylesheets/application.css
View
@@ -1,6 +1,7 @@
ForumApp::Application.routes.draw do
root :to => 'forums#index'
+ resources :blogs
resources :forums
resources :users
resources :sessions, :only => [:new, :create, :destroy]
@@ -1,6 +1,7 @@
class CreateBlogs < ActiveRecord::Migration
def change
create_table :blogs do |t|
+ t.boolean :restricted
t.string :url
t.string :rss
t.string :author
View
@@ -13,6 +13,7 @@
ActiveRecord::Schema.define(:version => 20110811040955) do
create_table "blogs", :force => true do |t|
+ t.boolean "restricted"
t.string "url"
t.string "rss"
t.string "author"
View
@@ -0,0 +1,6 @@
+namespace :db do
+ desc 'Run: drop, create, migrate and seed'
+ task :populate => :environment do
+ system 'rake db:drop --trace; rake db:create --trace; rake db:migrate --trace; rake db:seed --trace'
+ end
+end

0 comments on commit 00c60ea

Please sign in to comment.