Skip to content

Instantly share code, notes, and snippets.

@Mizpah
Mizpah / application.js
Created February 25, 2013 18:34
Here what I started with (application.js / index.js.erb), and the subsequent attempts. I also tried an entirely new game_classes_coffee.js. note the railscast version of the file (application.js) reads: ).live("click", -- have changed this to on mylsef.
$(function() {
$("#game_classes th a, #game_classes .pagination a").on("click", function() {
$.getScript(this.href);
return false;
});
$("#game_classes_search input").keyup(function() {
$.get($("#game_classes_search").attr("action"), $("#game_classes_search").serialize(), null, "script");
return false;
});
});
@Mizpah
Mizpah / _game_class.html.erb
Created February 25, 2013 00:12
The list game_classes page used to work, with sortable tables. It used a partial for the table body (header was in the index). Added pagination, better sortable tables, and a search field via several railscasts. I started to add ajaxification to all of the elements. Each intended change worked, so I am unsure where I introduced the error. Now th…
<table class="pretty">
<thead>
<tr>
<th><%= sortable "name" %></th>
<th>Description</th>
<th><%= sortable "game_id" %></th>
<th></th>
<th></th>
<th></th>
</tr>
@Mizpah
Mizpah / game_classes_controller.rb
Created February 24, 2013 02:33
I have a page with around 60 objects. Using Kaminari to create pagination. The first page example is the existing page. Everything in one table, and the columns have a sort link in the header. Th recipie for this was taken from a tutorial and adapted. I note that line '4' was explained as being 'critical to stop things breaking'. The second exam…
def index
@game_classes = GameClass.order("game_id").page(params[:page]).per(15)
@game_classes = GameClass.order(params[:sort]).page(params[:page]).per(15) if params[:sort]
#@game_classes = @game_classes.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @game_classes }
end
end
@Mizpah
Mizpah / schema.rb
Created February 24, 2013 00:42
Am working on an application that will play the role of a guild website, alongside the multiple systems that a guild needs. (mmo and other gaming communities). This has come about of the back of crating multiple website/system for this purpose that have to be scrapped whenever we change game, and getting tired of people needing good guild websit…
encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).