Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planet2012 definitivo #66

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ source 'https://rubygems.org'

gem 'rails', '3.2.2'

gem 'execjs'
gem 'therubyracer'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
#group :development, :test do
# gem 'sqlite3'
#end

group :development, :test do
gem 'sqlite3'
end

group :production do
gem 'pg'
end
#group :production do
# gem 'pg'
#end


gem 'devise'
Expand Down Expand Up @@ -47,5 +50,5 @@ gem 'paperclip'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

gem 'json', '1.6.5'
# gem 'json', '1.6.5'

16 changes: 9 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,21 @@ GEM
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.5)
json (1.6.6)
libv8 (3.3.10.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.18)
multi_json (1.3.1)
multi_json (1.3.2)
orm_adapter (0.0.7)
paperclip (3.0.2)
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (>= 0.0.2)
mime-types
pg (0.13.2)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
Expand All @@ -95,7 +95,7 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sass (3.1.15)
sass (3.1.16)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
Expand All @@ -104,7 +104,9 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
sqlite3 (1.3.6)
therubyracer (0.10.1)
libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
Expand All @@ -124,11 +126,11 @@ DEPENDENCIES
cleditor_rails
coffee-rails (~> 3.2.1)
devise
execjs
jquery-rails
json (= 1.6.5)
paperclip
pg
rails (= 3.2.2)
sass-rails (~> 3.2.3)
sqlite3
therubyracer
uglifier (>= 1.0.3)
Binary file added app/assets/images/antonio.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/favicon.ico
Binary file not shown.
Binary file added app/assets/images/fer.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/javascripts/comments.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/comments.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the comments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
9 changes: 9 additions & 0 deletions app/assets/stylesheets/planet.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@
background: #446;
}

#subirArriba {
float: right;
}

#bs{
margin-top: 2em;
width: 86px;
}

#main {
margin-left: 9em; /* Ajuste de borde izquierdo */
padding-top: 4ex;
Expand Down
169 changes: 169 additions & 0 deletions app/assets/stylesheets/planet.css~
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/* Global styles (no utilizados de momento) */

#planet #notice {
color: #000;
border: 2px solid red;
padding: 1em;
margin-bottom: 2em;
background-color: #f0f0f0;
font: bold smaller sans-serif;
}


#planet h1 {
font: 150% sans-serif;
color: #226;
border-bottom: 3px dotted #77d;
}

/* Styles for products/index */

#site_list table {
border-collapse: collapse;
}

#site_list table tr td {
padding: 5px;
vertical-align: top;
}

#site_list .list_image {
width: 60px;
height: 70px;
}

#site_list .list_description {
width: 60%;
}

#site_list .list_description dl {
margin: 0;
}

#site_list .list_description dt {
color: #244;
font-weight: bold;
font-size: larger;
}

#site_list .list_description dd {
margin: 0;
}

#site_list .list_actions {
font-size: x-small;
text-align: right;
padding-left: 1em;
}

#site_list .list_line_even {
background: #a8b8f8;
}

#site_list .list_line_odd {
background: #88b0f8;
}


/* START:mainlayout */
/* Styles for main page */

#banner {
background: #668;
padding-top: 10px;
padding-bottom: 10px;
border-bottom: 2px solid;
font: small-caps 40px/40px "Times New Roman", serif;
color: #bfb;
text-align: center;
}

#banner img {
float: left;
padding-left: 10px;
}

#banner .user {
float: right;
color: #bfb;
font-size: small;
}

#columns {
background: #446;
}

#main {
margin-left: 9em; /* Ajuste de borde izquierdo */
padding-top: 4ex;
padding-left: 2em;
background: white;
}

#side {
float: left;
padding-top: 1em;
padding-left: 1em;
padding-bottom: 1em;
width: 8em; /* Ajuste de borde izquierdo */
background: #446;
}

#side a {
color: #bfb;
font-size: small;
}
/* END:mainlayout */

/* An entry in the store catalog (no utilizados de momento) */

#planet .entry {
overflow: auto;
margin-top: 1em;
border-bottom: 1px dotted #77d;
}

#planet .name {
font-size: 120%;
font-family: sans-serif;
}

#store .entry img {
width: 80px;
margin-right: 5px;
margin-bottom: 5px;
float: left;
}


#store .entry h3 {
margin-top: 0;
margin-bottom: 2px;
color: #227;
}

#store .entry p {
margin-top: 0.5em;
margin-bottom: 0.8em;
}

#store .entry .price_line {
clear: both;
margin-bottom: 0.5em;
}

#store .entry .add_to_cart {
position: relative;
}

#store .entry .price {
color: #44a;
font-weight: bold;
margin-right: 2em;
}


#main .visitas {
text-indent: 70%;
}

3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# == En esta clase
# [clase ApplicationController] Definimos instrucción para posibles ataques al servidor.
class ApplicationController < ActionController::Base

protect_from_forgery
end
97 changes: 97 additions & 0 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Clase Ruby que hereda de +ApplicationController+.
# Cuando la aplicación reciba una petición referente a comentarios, la ruta determina qué controlador y acción realizar.
# == Métodos para controlador comentarios
# * index
# * show
# * new
# * edit
# * create
# * update
# * destroy
class CommentsController < ApplicationController
# GET /comments
# GET /comments.json
def index #gestiona las rutas anidadas
if params[:site_id].nil? or params[:site_id].empty?
@comments = Comment.all # path: /comment
else
@comments = Site.find(params[:site_id]).comments # path: /sites/id/comments
end

respond_to do |format|
format.html # index.html.erb
format.json { render json: @comments }
end
end

# GET /comments/1
# GET /comments/1.json
def show
@comment = Comment.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @comment }
end
end

# GET /comments/new
# GET /comments/new.json
def new
@comment = current_user.comments.build # crea comentario vacío asociado a current_user
respond_to do |format|
format.html # new.html.erb
format.json { render json: @comment }
end
end

# GET /comments/1/edit
def edit
@comment = current_user.comments.find(params[:id])
@site = @comment.site
end

# POST /comments
# POST /comments.json
def create
@comment = current_user.comments.build(params[:comment])

respond_to do |format|
if @comment.save
format.html { redirect_to @comment, notice: 'Comment was successfully created.' }
format.json { render json: @comment, status: :created, location: @comment }
else
format.html { render action: "new" }
format.json { render json: @comment.errors, status: :unprocessable_entity }
end
end
end

# PUT /comments/1
# PUT /comments/1.json
def update
@comment = current_user.comments.find(params[:id])

respond_to do |format|
if @comment.update_attributes(params[:comment])
format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @comment.errors, status: :unprocessable_entity }
end
end
end

# DELETE /comments/1
# DELETE /comments/1.json
def destroy
@comment = Comment.find(params[:id])
@comment.destroy

respond_to do |format|
format.html { redirect_to comments_url }
format.json { head :no_content }
end
end
end
Loading