Skip to content

Commit

Permalink
Add legacy route
Browse files Browse the repository at this point in the history
Link to old leap release if there is on specified in config/releases.yml
Show a flash on the /legacy view to notify users that there is a more
recent version.
  • Loading branch information
agraul committed Jun 8, 2018
1 parent f6db9cc commit 34f489c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def set_releases_parameters
@stable_version = current['stable_version']
@testing_version = current['testing_version']
@testing_state = current['testing_state']
@legacy_release = current['legacy_release']
@legacy_release = current['legacy_version']
end

def set_baseproject
Expand Down
14 changes: 13 additions & 1 deletion app/controllers/distributions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class DistributionsController < OBSController
before_action :set_releases_parameters, only: %i[index testing leap]
before_action :set_releases_parameters, only: %i[index testing leap legacy]

# GET /distributions
def index
Expand Down Expand Up @@ -34,4 +34,16 @@ def testing
flash[:notice] = _('Help test the next version of openSUSE Leap!')
render action: "leap-#{@testing_version}", layout: 'download'
end

# GET /distributions/legacy
def legacy
@hide_search_box = true
unless @legacy_release
redirect_to '/', flash: { error: _("No legacy distribution available") }
return
end
@version = @legacy_release
flash.now[:notice] = _("There is a new version of openSUSE Leap <a href='/distributions/leap'>available</a>!")
render action: "leap-#{@legacy_release}", layout: 'download'
end
end
9 changes: 7 additions & 2 deletions app/views/distributions/leap-15.0.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,16 @@
</div><!-- /.card -->
</div><!-- /.card-deck -->
</div><!-- /.tab-pane -->

</div><!-- /.tab-content -->

<div class="mt-3">
<% if @legacy_release %>
<%= link_to _('Download previous openSUSE Leap release'),
legacy_distributions_path %>
<% end %>
</div>
</div><!-- /.container -->


</section>

<section class="my-5">
Expand Down
6 changes: 6 additions & 0 deletions app/views/distributions/leap-42.3.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@
</div><!-- /.card-deck -->
</div><!-- /#unofficial-ports.tab-pane -->
</div><!-- /.tab-content -->
<div class="mt-3">
<% if @stable_version %>
<%= link_to _('Download latest openSUSE Leap release'),
leap_distributions_path %>
<% end %>
</div>
</div><!-- /.container -->
</section>

Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
get 'leap'
get 'leap/ports', to: 'distributions#leap_ports'
get 'testing'
get 'legacy'
end
end

Expand Down

0 comments on commit 34f489c

Please sign in to comment.