Skip to content

Commit

Permalink
Added games. yes.
Browse files Browse the repository at this point in the history
  • Loading branch information
minivan committed Mar 10, 2015
1 parent 0b63d87 commit f68c247
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 21 deletions.
27 changes: 24 additions & 3 deletions app/assets/stylesheets/index.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ hr {
border: 0;
}


html {
@extend %extend_1;
}
Expand Down Expand Up @@ -206,15 +205,37 @@ nav {
span.match {
color: $color_cornflower_blue_approx;
}
p.found {
color: $color_celeste_approx;
h6 {
color: $color_mountain_mist_approx;
text-align: center;
padding-top: 15px;
padding-bottom: 5px;
font-size: 12pt;
font-weight: 400;
}
input.error {
border: 2px solid $color_sea_pink_approx;
&:focus {
border: 2px solid $color_sea_pink_approx;
}
}

#games {
margin: auto;
width: 700px;
.title {

}
ul {
li {
a {
text-decoration: none;
color: $black;
&:hover {
border-bottom: 1px dotted $color_cornflower_blue_approx;
}
}
padding: 5px;
}
}
}
1 change: 1 addition & 0 deletions app/controllers/games_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ def index

def show
@game = Game.find(params[:id])
@questions = @game.questions.page(params[:page])
end
end
11 changes: 11 additions & 0 deletions app/helpers/game_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module GameHelper
def game_title(game)
if game.season
str = "C#{game.date.year}#{game.season[0]} etapa #{game.tour}"
else
str = "#{game.competition} #{game.date.year} #{game.cup_name} #{game.elitar_name}"
end
str += " (#{truncate(game.authors, length: 60, separator: ",", omission: ", ...")})" if game.authors
str
end
end
11 changes: 1 addition & 10 deletions app/models/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,4 @@ class Game < ActiveRecord::Base
has_many :questions

default_scope { order('date DESC') }
def title
if season
str = "C#{date.year}#{season[0]} etapa #{tour}"
else
str = "#{competition} #{date.year} #{cup_name} #{elitar_name}"
end
str += " (#{authors})" if authors
str
end
end
end
4 changes: 2 additions & 2 deletions app/views/games/_game.html.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.wat
=link_to game.title, game
%li.game
=link_to game_title(game), game
9 changes: 6 additions & 3 deletions app/views/games/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Ultimile pachete:
=render @games
=paginate @games
%h6
Ultimile pachete:
#games
%ul
=render @games
=paginate @games
10 changes: 9 additions & 1 deletion app/views/games/show.html.haml
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
= render @game.questions
#results
%ul
= render @questions
= paginate @questions
:coffeescript
$ ->
$(".collapsed").click ->
$(@).siblings(".extras").toggleClass("hidden")
$(@).find("i").toggleClass("fa-angle-double-down")
2 changes: 1 addition & 1 deletion app/views/search/results.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%form.search{ action: "search", method: :get}
= text_field_tag(:query, nil, placeholder:"Caută în textul intrebării", autocomplete: 'off', value: @terms)
#results
%p.found
%h6
#{page_entries_info @results}
%ul
- @results.each do |result|
Expand Down
21 changes: 20 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,29 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20141121124055) do
ActiveRecord::Schema.define(version: 20150226211147) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "games", force: true do |t|
t.string "competition"
t.string "tour"
t.string "season"
t.string "cup_name"
t.string "elitar_name"
t.string "level"
t.string "authors"
t.string "editors"
t.text "additional_info"
t.string "game_slug"
t.string "submitter"
t.integer "number_questions"
t.datetime "date"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "pg_search_documents", force: true do |t|
t.text "content"
t.integer "searchable_id"
Expand All @@ -36,6 +54,7 @@
t.string "team_name"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "game_id"
end

end

0 comments on commit f68c247

Please sign in to comment.