class EntriesController

Public Instance Methods

confirm_destroy() click to toggle source
# File app/controllers/entries_controller.rb, line 47
def confirm_destroy
end
create() click to toggle source
# File app/controllers/entries_controller.rb, line 19
def create
  @entry = Entry.new(params[:entry])
  if @entry.save
    redirect_to project_entry_path(@entry.project, @entry), :notice => entry_flash(@entry).html_safe
  else
    render :new
  end
end
destroy() click to toggle source
# File app/controllers/entries_controller.rb, line 50
def destroy
  @entry.destroy
  redirect_to(entries_path, :notice => "Awesome. You deleted #{@entry.title}")
end
edit() click to toggle source
# File app/controllers/entries_controller.rb, line 28
def edit
end
index() click to toggle source
# File app/controllers/entries_controller.rb, line 6
def index
  @entries = current_user.entries.skinny.order(:search_text).paginate :page => params[:page]
  @tags = current_user.entries.tag_counts_on(:tags).order(:name)
end
new() click to toggle source
# File app/controllers/entries_controller.rb, line 11
def new
  @entry = Entry.new
  project_guid = params[:project]
  unless project_guid.blank?
    @entry.project_id = Project.find_by_guid(project_guid).id
  end
end
paginate() click to toggle source
# File app/controllers/entries_controller.rb, line 55
def paginate
  tag_name = params[:tag_name].to_s
  entries = current_user.entries
  entries = entries.tagged_with(tag_name) unless tag_name.blank?
  entries = entries.skinny.order(:search_text).limit(30).offset(params[:idx])
  render :json => entries.to_json(:methods => [:project_guid, :project_name])
end
show() click to toggle source
# File app/controllers/entries_controller.rb, line 31
def show
  respond_to do |format|
    format.html
    format.json { render :json => @entry.to_json(:include => [:project],
        :methods => [:notes, :password, :username, :url, :tags]) }
  end
end
tagged() click to toggle source
# File app/controllers/entries_controller.rb, line 63
def tagged
  @tag_name = params[:tag_name].to_s
  @entries = current_user.entries.tagged_with(@tag_name).order(:search_text)
                         .paginate :page => params[:page]
  @tags = current_user.entries.tag_counts_on(:tags).order(:name)
  render :index
end
update() click to toggle source
# File app/controllers/entries_controller.rb, line 39
def update
  if @entry.update_attributes(params[:entry])
    redirect_to project_entry_path(@entry.project, @entry), :notice => entry_flash(@entry).html_safe
  else
    render :edit
  end
end