Created
August 30, 2012 02:35
-
-
Save carloncarpio/3521815 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VipbbsrsbbsController < ApplicationController | |
# GET /vipbbsrsbbs | |
# GET /vipbbsrsbbs.json | |
def index | |
@vipbbsrsbbs = Vipbbsrsbb.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @vipbbsrsbbs } | |
end | |
end | |
# GET /vipbbsrsbbs/1 | |
# GET /vipbbsrsbbs/1.json | |
def show | |
@vipbbsrsbb = Vipbbsrsbb.find(params[:id]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render json: @vipbbsrsbb } | |
end | |
end | |
# GET /vipbbsrsbbs/new | |
# GET /vipbbsrsbbs/new.json | |
def new | |
@vipbbsrsbb = Vipbbsrsbb.new | |
respond_to do |format| | |
format.html # new.html.erb | |
format.json { render json: @vipbbsrsbb } | |
end | |
end | |
# GET /vipbbsrsbbs/1/edit | |
def edit | |
@vipbbsrsbb = Vipbbsrsbb.find(params[:id]) | |
end | |
# POST /vipbbsrsbbs | |
# POST /vipbbsrsbbs.json | |
def create | |
@vipbbsrsbb = Vipbbsrsbb.new(params[:vipbbsrsbb]) | |
respond_to do |format| | |
if @vipbbsrsbb.save | |
format.html { redirect_to @vipbbsrsbb, notice: 'Vipbbsrsbb was successfully created.' } | |
format.json { render json: @vipbbsrsbb, status: :created, location: @vipbbsrsbb } | |
else | |
format.html { render action: "new" } | |
format.json { render json: @vipbbsrsbb.errors, status: :unprocessable_entity } | |
end | |
end | |
end | |
# PUT /vipbbsrsbbs/1 | |
# PUT /vipbbsrsbbs/1.json | |
def update | |
@vipbbsrsbb = Vipbbsrsbb.find(params[:id]) | |
respond_to do |format| | |
if @vipbbsrsbb.update_attributes(params[:vipbbsrsbb]) | |
format.html { redirect_to @vipbbsrsbb, notice: 'Vipbbsrsbb was successfully updated.' } | |
format.json { head :no_content } | |
else | |
format.html { render action: "edit" } | |
format.json { render json: @vipbbsrsbb.errors, status: :unprocessable_entity } | |
end | |
end | |
end | |
# DELETE /vipbbsrsbbs/1 | |
# DELETE /vipbbsrsbbs/1.json | |
def destroy | |
@vipbbsrsbb = Vipbbsrsbb.find(params[:id]) | |
@vipbbsrsbb.destroy | |
respond_to do |format| | |
format.html { redirect_to vipbbsrsbbs_url } | |
#format.json { head :no_content } | |
format.js | |
end | |
end | |
def visual | |
@vipbbsrsbbs_a = Vipbbsrsbb.find_section('A') | |
@vipbbsrsbbs_b = Vipbbsrsbb.find_section('B') | |
@vipbbsrsbbs_c = Vipbbsrsbb.find_section('C') | |
@vipbbsrsbbs_d = Vipbbsrsbb.find_section('D') | |
@vipbbsrsbbs_e = Vipbbsrsbb.find_section('E') | |
end | |
def update_status | |
@vipbbsrsbb = Vipbbsrsbb.find(params[:id]) | |
#@vipbbsrsbb.update_attribute :status, true | |
respond_to do |format| | |
if @vipbbsrsbb.status == false | |
if @vipbbsrsbb.update_attribute :status, true | |
#format.html { redirect_to @vipbbsrsbb, notice: 'Vipbbsrsbb was successfully updated.' } | |
#format.json { head :no_content } | |
format.js | |
else | |
redirect_to 'http://www.google.com' | |
#format.html { render action: "edit" } | |
#format.json { render json: @vipbbsrsbb.errors, status: :unprocessable_entity } | |
end | |
else | |
if @vipbbsrsbb.update_attribute :status, false | |
#format.html { redirect_to @vipbbsrsbb, notice: 'Vipbbsrsbb was successfully updated.' } | |
#format.json { head :no_content } | |
format.js | |
else | |
redirect_to 'http://www.google.com' | |
#format.html { render action: "edit" } | |
#format.json { render json: @vipbbsrsbb.errors, status: :unprocessable_entity } | |
end | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Listing vipbbsrsbbs</h1> | |
<table> | |
<tr> | |
<th>Ticket num</th> | |
<th>Company name</th> | |
<th>Company contact</th> | |
<th>Company email</th> | |
<th>Approved</th> | |
<th></th> | |
<th></th> | |
<th></th> | |
</tr> | |
<% @vipbbsrsbbs.each do |vipbbsrsbb| %> | |
<tr id='<%= dom_id vipbbsrsbb %>'> | |
<td><%= vipbbsrsbb.ticket_num %></td> | |
<td><%= vipbbsrsbb.company_name %></td> | |
<td><%= vipbbsrsbb.company_contact %></td> | |
<td><%= vipbbsrsbb.company_email %></td> | |
<td><%= vipbbsrsbb.status %></td> | |
<td><%= link_to 'Show', vipbbsrsbb %></td> | |
<td><%= link_to 'Edit', edit_vipbbsrsbb_path(vipbbsrsbb) %></td> | |
<td><%= link_to 'Destroy', vipbbsrsbb, confirm: 'Are you sure?', method: :delete, remote: true %></td> | |
</tr> | |
<% end %> | |
</table> | |
<br /> | |
<%= link_to 'New Reservation', new_vipbbsrsbb_path %> | |
<%= link_to 'View', :controller => 'Vipbbsrsbbs', :action => 'visual' %> | |
<%= link_to 'Back to View', :controller => 'Vipbbsrsbbs', :action => 'new' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vipbbsrsbb < ActiveRecord::Base | |
def self.find_section(section="") | |
section = Vipbbsrsbb.where(:section => section) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("#<%= dom_id(@vipbbsrsbb) %>").toggleClass('true'); | |
location.reload(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<tr> | |
<% @vipbbsrsbbs_a.each do |vipbbsrsbb_a| %> | |
<td class="<%= vipbbsrsbb_a.status %>" id='<%= dom_id vipbbsrsbb_a %>'> | |
<%= link_to vipbbsrsbb_a.ticket_num, {:controller => 'vipbbsrsbbs' ,:action => 'update_status', :id => vipbbsrsbb_a.id}, remote: true %></td> | |
<% end %> | |
</tr> | |
<tr> | |
<% @vipbbsrsbbs_b.each do |vipbbsrsbb_b| %> | |
<td class="<%= vipbbsrsbb_b.status %>"><%= link_to(vipbbsrsbb_b.ticket_num, :action => 'show', :id => vipbbsrsbb_b.id) %></td> | |
<% end %> | |
</tr> | |
<tr> | |
<% @vipbbsrsbbs_c.each do |vipbbsrsbb_c| %> | |
<td class="<%= vipbbsrsbb_c.status %>"><%= link_to(vipbbsrsbb_c.ticket_num, :action => 'show', :id => vipbbsrsbb_c.id) %></td> | |
<% end %> | |
</tr> | |
<tr> | |
<% @vipbbsrsbbs_d.each do |vipbbsrsbb_d| %> | |
<td class="<%= vipbbsrsbb_d.status %>"><%= link_to(vipbbsrsbb_d.ticket_num, :action => 'show', :id => vipbbsrsbb_d.id) %></td> | |
<% end %> | |
</tr> | |
<tr> | |
<% @vipbbsrsbbs_e.each do |vipbbsrsbb_e| %> | |
<td class="<%= vipbbsrsbb_e.status %>"><%= link_to(vipbbsrsbb_e.ticket_num, :action => 'show', :id => vipbbsrsbb_e.id) %></td> | |
<% end %> | |
</tr> | |
</table> | |
<%= link_to 'Back To List', :action => 'index' %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment