Class: Iconly::ProjectsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Iconly::ProjectsController
- Defined in:
- app/controllers/iconly/projects_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #generate_font ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/iconly/projects_controller.rb', line 22 def create @project = current_user.projects.build(project_params) if @project.save redirect_to project_path(@project), notice: '<i class="iconly-baby mr-05"></i> Great, a new project was created!' else render :new end end |
#destroy ⇒ Object
52 53 54 55 |
# File 'app/controllers/iconly/projects_controller.rb', line 52 def destroy @project.destroy redirect_to projects_url, notice: '<i class="iconly-baby mr-05"></i> Project is gone to the bin.' end |
#edit ⇒ Object
19 20 |
# File 'app/controllers/iconly/projects_controller.rb', line 19 def edit end |
#generate_font ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/iconly/projects_controller.rb', line 42 def generate_font if (zip_file = Project::Downloader.new(@project).call) send_file zip_file else flash[:error] = '<i class="iconly-baby2 mr-05"></i> '\ 'Sorry an error occurred generating the font, please try again.' redirect_to project_path(@project) end end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/iconly/projects_controller.rb', line 7 def index @projects = ProjectIcon.all_projects(current_user.id, params[:q]) end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/iconly/projects_controller.rb', line 15 def new @project = Project.new end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/iconly/projects_controller.rb', line 11 def show @packages = Icon.all_packages(current_user.id, params[:q]) end |
#update ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/iconly/projects_controller.rb', line 33 def update if @project.update(project_params) redirect_to project_path(@project), notice: '<i class="iconly-baby mr-05"></i> Awsome, project updated all right!' else render :edit end end |