Class: MystroVolley::HomeController

Inherits:
ApplicationController show all
Includes:
ApplicationHelper
Defined in:
app/controllers/mystro_volley/home_controller.rb

Instance Method Summary collapse

Methods included from ApplicationHelper

#path_helper

Instance Method Details

#browserObject



10
11
12
# File 'app/controllers/mystro_volley/home_controller.rb', line 10

def browser
  @projects = MystroVolley::Project.all
end

#indexObject



5
6
7
8
# File 'app/controllers/mystro_volley/home_controller.rb', line 5

def index
  #@projects = MystroVolley::Project.all
  @myversions = MystroVolley::Version.desc(:timestamp).where(latest: true)
end

#showObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/mystro_volley/home_controller.rb', line 14

def show
  p = params[:project]
  b = params[:branch]
  v = params[:version]

  if p
    @project = MystroVolley::Project.where(name: p).first

    if @project
      if b
        @branch = @project.branches.where(name: b).first
        if @branch
          if v
            @version = @branch.versions.where(name: v).first
            if @version
              return render "mystro_volley/versions/show"
            else
              flash.now[:error] = "version #{v} not found"
              return render "mystro_volley/branches/show"
            end
          else
            return render "mystro_volley/branches/show"
          end
        else
          flash.now[:error] = "branch #{b} not found"
          return render "mystro_volley/projects/show"
        end
      else
        return render "mystro_volley/projects/show"
      end
    else
      #@myversions = MystroVolley::Version.desc(:timestamp).where(latest: true)
      #render "mystro_volley/versions/index"
      flash.now[:error] = "project #{p} not found"
    end
  else
    @myversions = MystroVolley::Version.desc(:timestamp).where(latest: true)
    render "mystro_volley/versions/index"
  end
end