app/assets/javascripts/ponytail/views/migrations/migrations_index.coffee in ponytail-0.5.0 vs app/assets/javascripts/ponytail/views/migrations/migrations_index.coffee in ponytail-0.6.0

- old
+ new

@@ -5,11 +5,32 @@ "click .delete_file": "clickDeleteFile" "click .new_button": "clickNewButton" "click .migrate_button": "clickMigrateButton" "click .rollback_button": "clickRollbackButton" - render: -> - @highlightCode() + initialize: -> + @migrations = new Ponytail.Collections.Migrations() + @schema = new Ponytail.Models.Schema() + + render: => + @migrations.fetch + success: => + @migrations.each (model) -> + v = new Ponytail.Views.MigrationsItem({model: model}) + @$(".migration_files table tbody").append(v.render().el) + + @schema.fetch + success: => + for el in @$("tr") + version = $(el).find(".version").text() + if parseInt(version) == @schema.get("version") + $(el).prepend("<td>*</td>") + else + $(el).prepend("<td></td>") + + v = new Ponytail.Views.PreviewMigration({model: @migrations.head()}) + @$(".migration_file").replaceWith(v.render().el) + @highlightCode() @ highlightCode: -> for el in $('pre code') hljs.highlightBlock(el)