ponytail 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -3
  3. data/README.md +2 -2
  4. data/app/assets/javascripts/ponytail/application.js +1 -0
  5. data/app/assets/javascripts/ponytail/models/schema.coffee +2 -0
  6. data/app/assets/javascripts/ponytail/views/column.coffee +3 -1
  7. data/app/assets/javascripts/ponytail/views/migrations/migrations_index.coffee +66 -0
  8. data/app/assets/javascripts/ponytail/views/migrations/migrations_new.coffee +53 -0
  9. data/app/assets/javascripts/ponytail/views/preview_create_file.coffee +37 -0
  10. data/app/assets/javascripts/ponytail/views/table.coffee +11 -1
  11. data/app/assets/stylesheets/ponytail/_base.scss +23 -1
  12. data/app/assets/stylesheets/ponytail/_index.scss +8 -8
  13. data/app/assets/stylesheets/ponytail/_new.scss +7 -4
  14. data/app/assets/stylesheets/ponytail/application.scss +3 -0
  15. data/app/controllers/ponytail/migrations_controller.rb +11 -27
  16. data/app/controllers/ponytail/schemas_controller.rb +27 -0
  17. data/app/views/ponytail/migrations/index.html.erb +26 -15
  18. data/app/views/ponytail/migrations/new.html.erb +18 -61
  19. data/lib/ponytail/migration.rb +27 -7
  20. data/lib/ponytail/routing/mapper.rb +10 -0
  21. data/lib/ponytail/schema.rb +24 -14
  22. data/lib/ponytail/version.rb +1 -1
  23. data/lib/ponytail.rb +1 -1
  24. data/spec/controllers/ponytail/migrations_controller_spec.rb +65 -0
  25. data/spec/controllers/ponytail/schemas_controller_spec.rb +40 -0
  26. data/spec/dummy/app/controllers/top_controller.rb +5 -0
  27. data/spec/dummy/config/initializers/ponytail_on_heroku.rb +6 -8
  28. data/spec/dummy/config/routes.rb +1 -0
  29. data/spec/javascripts/helpers/build_model.coffee +7 -0
  30. data/spec/javascripts/ponytail/models/column_spec.coffee +1 -0
  31. data/spec/javascripts/ponytail/models/create_command_spec.coffee +12 -0
  32. data/spec/javascripts/ponytail/models/migration_file_spec.coffee +13 -0
  33. data/spec/javascripts/ponytail/models/table_spec.coffee +18 -0
  34. data/spec/{ponytail → lib/ponytail}/migration_spec.rb +0 -18
  35. data/spec/lib/ponytail/schema_spec.rb +16 -0
  36. data/spec/{ponytail_spec.rb → lib/ponytail/version_spec.rb} +0 -0
  37. data/spec/routing/migrations_routing_spec.rb +19 -0
  38. data/spec/routing/schemas_routing_spec.rb +11 -0
  39. data/vendor/assets/javascripts/highlight.pack.js +1 -0
  40. data/vendor/assets/stylesheets/github.css +130 -0
  41. metadata +36 -28
  42. data/app/assets/javascripts/ponytail/views/index.coffee +0 -29
  43. data/app/assets/javascripts/ponytail/views/migration_file.coffee +0 -25
  44. data/app/assets/javascripts/ponytail/views/new.coffee +0 -58
  45. data/lib/rails/mapper.rb +0 -12
  46. data/spec/controllers/migrations_controller_spec.rb +0 -92
  47. data/spec/javascripts/helpers/.keep +0 -0
  48. data/spec/javascripts/helpers/build_model.js +0 -11
  49. data/spec/javascripts/ponytail/models/column_spec.js +0 -2
  50. data/spec/javascripts/ponytail/models/create_command_spec.js +0 -15
  51. data/spec/javascripts/ponytail/models/migration_file_spec.js +0 -16
  52. data/spec/javascripts/ponytail/models/table_spec.js +0 -24
  53. data/spec/ponytail/schema_spec.rb +0 -23
  54. data/spec/rails/mapper_spec.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9553f78286daeb6dc406f9e022908bc3ac78ecae
4
- data.tar.gz: e81493dda4b5607c352910c9cb65750535cc0b30
3
+ metadata.gz: 41a7ab39f2aa8e3b19fae0b2c8e609212aea06ef
4
+ data.tar.gz: 505d33b61f8e1a2c5f1aa6176d5402c98fb5ef1a
5
5
  SHA512:
6
- metadata.gz: 1fd9a32b54437ce171f4926898036523b024ab7a2887d7f563bc8beed55a626898b30c55cf069238a0f07371707064e6c8ad6af132f46b4124f84859747264f2
7
- data.tar.gz: 6b103807b2e771c6542d9f185c021b6df345c6796938a7f30d5100c015f2d0242bb8e8eeb75bd40128a604d0a5f77a83dd2e7b69211922257c51a0b138819de9
6
+ metadata.gz: 1aab440243c8ab54f3392721b5fc6b670742ae30478e50bbb53d0f76a08042f301950f1b5df67dc60fc0d0e46ff680e547491723497d041df44633e2e1796e3c
7
+ data.tar.gz: 450c4f84a0a2798e66bb552b0e79d1bc669708770065d4683d6b81651a3f6e64f52f8a36539782d547b15b014ee4b70bad2368361d740f0cb9753f4d0f26ef74
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ponytail (0.4.0)
4
+ ponytail (0.5.0)
5
5
  coffee-rails (~> 4.0.0)
6
6
  compass-rails
7
7
  rails (~> 4.0.0)
@@ -37,7 +37,7 @@ GEM
37
37
  arel (4.0.1)
38
38
  atomic (1.1.14)
39
39
  builder (3.1.4)
40
- capybara (2.2.0)
40
+ capybara (2.2.1)
41
41
  mime-types (>= 1.16)
42
42
  nokogiri (>= 1.3.3)
43
43
  rack (>= 1.0.0)
@@ -123,8 +123,9 @@ GEM
123
123
  rspec-expectations (2.14.4)
124
124
  diff-lcs (>= 1.1.3, < 2.0)
125
125
  rspec-mocks (2.14.4)
126
- rspec-rails (2.14.0)
126
+ rspec-rails (2.14.1)
127
127
  actionpack (>= 3.0)
128
+ activemodel (>= 3.0)
128
129
  activesupport (>= 3.0)
129
130
  railties (>= 3.0)
130
131
  rspec-core (~> 2.14.0)
data/README.md CHANGED
@@ -32,7 +32,7 @@ Comment out `config.active_record.migration_error` in `config/environments/devel
32
32
 
33
33
  ## Usage
34
34
 
35
- Visit `/rails/migrations` in your app.
35
+ Visit `/ponytail/migrations` in your app.
36
36
 
37
37
  ## How to work dummy app
38
38
 
@@ -46,7 +46,7 @@ $ rails s
46
46
 
47
47
  Dummy app is deploying on heroku. However, you can not change the migration files and databases.
48
48
 
49
- http://ponytail.herokuapp.com/rails/migrations
49
+ http://ponytail.herokuapp.com/
50
50
 
51
51
  ## Contributing
52
52
 
@@ -2,6 +2,7 @@
2
2
  //= require jquery_ujs
3
3
  //= require underscore-min
4
4
  //= require backbone-min
5
+ //= require highlight.pack
5
6
  //= require ./ponytail
6
7
  //= require_tree ./models
7
8
  //= require_tree ./collections
@@ -0,0 +1,2 @@
1
+ class Ponytail.Models.Schema extends Backbone.Model
2
+ url: '/ponytail/schema'
@@ -1,4 +1,6 @@
1
1
  class Ponytail.Views.Column extends Backbone.View
2
+ template: ->
3
+ _.template($("#column_template").html(), @model.attributes)
2
4
  className: "column"
3
5
  events:
4
6
  "click .column_type": "clickColumnType"
@@ -16,7 +18,7 @@ class Ponytail.Views.Column extends Backbone.View
16
18
 
17
19
  render: =>
18
20
  if @el.parentNode == null
19
- $(@el).html(_.template($("#column_template").html(), @model.attributes))
21
+ $(@el).html(@template())
20
22
  else
21
23
  @$(".column_type span").text(@model.get("type"))
22
24
  @$(".column_name span").text(@model.get("name"))
@@ -0,0 +1,66 @@
1
+ class Ponytail.Views.MigrationsIndex extends Backbone.View
2
+ events:
3
+ "click .close a": "closeNotice"
4
+ "click .migration_files .filename": "clickFileName"
5
+ "click .delete_file": "clickDeleteFile"
6
+ "click .new_button": "clickNewButton"
7
+ "click .migrate_button": "clickMigrateButton"
8
+ "click .rollback_button": "clickRollbackButton"
9
+
10
+ render: ->
11
+ @highlightCode()
12
+ @
13
+
14
+ highlightCode: ->
15
+ for el in $('pre code')
16
+ hljs.highlightBlock(el)
17
+
18
+ closeNotice: ->
19
+ $(".notice").hide()
20
+ false
21
+
22
+ clickFileName: (e) ->
23
+ @$(".migration_file .migration_filename").text(e.target.innerHTML)
24
+ @$(".migration_file .migration_filename").removeClass("highlight")
25
+ setTimeout( ->
26
+ @$(".migration_file .migration_filename").addClass("highlight")
27
+ , 100)
28
+ raw_content = $(e.target).parent().find(".raw_content").text()
29
+ @$(".migration_file .raw_content pre code").text(raw_content)
30
+ @highlightCode()
31
+
32
+ clickDeleteFile: (e) ->
33
+ if confirm('Are you sure?')
34
+ version = $(e.target).parent().parent().find(".version").text()
35
+ $.ajax
36
+ dataType: 'json'
37
+ url: "/ponytail/migrations/#{version}"
38
+ type: 'DELETE'
39
+ success: -> window.location.href = "/ponytail/migrations"
40
+ false
41
+
42
+ clickNewButton: ->
43
+ window.location.href = "migrations/new"
44
+
45
+ clickMigrateButton: ->
46
+ latest_version = $("tr:last .version").text()
47
+ $.ajax
48
+ dataType: 'json'
49
+ url: '/ponytail/schema'
50
+ data:
51
+ ponytail_schema:
52
+ version: latest_version
53
+ type: 'PATCH'
54
+ success: () -> window.location.href = "/ponytail/migrations"
55
+
56
+ clickRollbackButton: ->
57
+ rollback_index = $("tr").index($(".current"))
58
+ rollback_version = $("tr:eq(#{rollback_index - 1}) .version").text()
59
+ $.ajax
60
+ dataType: 'json'
61
+ url: '/ponytail/schema'
62
+ data:
63
+ ponytail_schema:
64
+ version: rollback_version
65
+ type: 'PATCH'
66
+ success: -> window.location.href = "/ponytail/migrations"
@@ -0,0 +1,53 @@
1
+ class Ponytail.Views.MigrationsNew extends Backbone.View
2
+ events:
3
+ "click .close a": "closeNotice"
4
+ "click .table_name": "clickTableName"
5
+ "click .new_table a": "clickNewTable"
6
+
7
+ initialize: ->
8
+ @tables = []
9
+
10
+ render: =>
11
+ schema = new Ponytail.Models.Schema()
12
+ schema.fetch
13
+ success: =>
14
+ for table_attrs in schema.get('tables')
15
+ m = new Ponytail.Models.Table(table_attrs)
16
+ v = new Ponytail.Views.Table({model: m})
17
+ @$(".new_table").before(v.render().el)
18
+ @tables.push(m)
19
+
20
+ class_name = @$(".classname input")[0].value
21
+ @migrationFile = new Ponytail.Models.MigrationFile({className: class_name})
22
+ new Ponytail.Views.PreviewCreateFile({el: @$(".migration_file"), model: @migrationFile})
23
+ @migrationFile.update()
24
+
25
+ for table in @tables
26
+ table.bind("change", =>
27
+ @migrationFile.updateByTables(@tables)
28
+ )
29
+ @
30
+
31
+ closeNotice: ->
32
+ $(".notice").hide()
33
+ false
34
+
35
+ clickTableName: (e) ->
36
+ tableElem = $(e.target).parent().parent()
37
+ columnsElem = tableElem.find(".columns")
38
+ if columnsElem.is(':visible')
39
+ columnsElem.slideUp()
40
+ else
41
+ columnsElem.slideDown()
42
+
43
+ clickNewTable: ->
44
+ table = new Ponytail.Models.Table({isCreated: true})
45
+ @tables.push(table)
46
+ table.bind("change", =>
47
+ @migrationFile.updateByTables(@tables)
48
+ )
49
+ table.trigger("change")
50
+
51
+ view = new Ponytail.Views.Table({model: table})
52
+ @$(".new_table").before(view.render().el)
53
+ false
@@ -0,0 +1,37 @@
1
+ class Ponytail.Views.PreviewCreateFile extends Backbone.View
2
+ events:
3
+ "click .edit_checkbox input": "clickEditCheckbox"
4
+ "keyup .classname input": (e) ->
5
+ @model.set({className: e.target.value})
6
+ "keyup .raw_content textarea": (e) ->
7
+ @model.set({rawContent: e.target.value})
8
+ "click .create_button": "clickCreateButton"
9
+
10
+ initialize: ->
11
+ @model.bind("change", @render)
12
+
13
+ render: =>
14
+ @$(".raw_content pre code").text(@model.get("rawContent"))
15
+ if !(@$(".raw_content textarea").is(":visible"))
16
+ @$(".raw_content textarea").val(@model.get("rawContent"))
17
+ @highlightCode()
18
+ @
19
+
20
+ highlightCode: ->
21
+ for el in $('pre code')
22
+ hljs.highlightBlock(el)
23
+
24
+ clickEditCheckbox: ->
25
+ @$(".raw_content pre").toggle()
26
+ @$(".raw_content textarea").toggle()
27
+
28
+ clickCreateButton: ->
29
+ $.ajax
30
+ dataType: 'json'
31
+ url: '/ponytail/migrations'
32
+ data:
33
+ ponytail_migration:
34
+ name: @model.get("className")
35
+ raw_content: @model.get("rawContent")
36
+ type: 'POST'
37
+ success: -> window.location.href = "/ponytail/migrations"
@@ -1,4 +1,6 @@
1
1
  class Ponytail.Views.Table extends Backbone.View
2
+ template: ->
3
+ _.template($("#table_template").html(), @model.attributes)
2
4
  className: "table"
3
5
  events:
4
6
  "click .edit_table": "clickEditTable"
@@ -14,7 +16,15 @@ class Ponytail.Views.Table extends Backbone.View
14
16
 
15
17
  render: =>
16
18
  if @el.parentNode == null
17
- $(@el).html(_.template($("#table_template").html(), @model.attributes))
19
+ $(@el).html(@template())
20
+ columns = []
21
+ for column_attrs in @model.get('columns')
22
+ column_attrs.table = @model
23
+ m = new Ponytail.Models.Column(column_attrs)
24
+ v = new Ponytail.Views.Column({model: m})
25
+ @$(".add_column").before(v.render().el)
26
+ columns.push(m)
27
+ @model.set({columns: columns}, {silent: true})
18
28
  else
19
29
  @$(".table_name span").text(@model.get("name"))
20
30
  @
@@ -8,7 +8,29 @@
8
8
  @include box-orient(vertical);
9
9
  }
10
10
 
11
- @keyframes highlight {
11
+ @mixin keyframes($animationName) {
12
+ @-webkit-keyframes #{$animationName} {
13
+ @content;
14
+ }
15
+ @-moz-keyframes #{$animationName} {
16
+ @content;
17
+ }
18
+ @-o-keyframes #{$animationName} {
19
+ @content;
20
+ }
21
+ @keyframes #{$animationName} {
22
+ @content;
23
+ }
24
+ }
25
+
26
+ @mixin animation($args) {
27
+ -webkit-animation: $args;
28
+ -moz-animation: $args;
29
+ -o-animation: $args;
30
+ animation: $args;
31
+ }
32
+
33
+ @include keyframes(highlight) {
12
34
  0% { background-color: yellow; }
13
35
  100% { background-color: white; }
14
36
  }
@@ -6,7 +6,8 @@
6
6
  .container {
7
7
  @extend .horizontal-box;
8
8
 
9
- > div {
9
+ // TODO: bad style name
10
+ .left_div {
10
11
  @include box-flex(1);
11
12
  margin: 0 2px;
12
13
  }
@@ -31,26 +32,25 @@
31
32
  }
32
33
  }
33
34
 
35
+ .version,
34
36
  .raw_content {
35
37
  display: none;
36
38
  }
37
39
  }
38
40
 
39
41
  .migration_file {
42
+ width: 500px;
43
+ margin: 0 2px;
44
+
40
45
  .migration_filename {
41
46
  margin: 2px 0;
42
47
  padding: 2px;
43
48
 
44
49
  &.highlight {
45
- animation: highlight 1s 1;
50
+ @include animation(highlight 1s 1);
46
51
  }
47
52
  }
48
53
  .raw_content {
49
- @include border-radius(5px);
50
- background: whitesmoke;
51
- margin-top: 2px;
52
- padding: 5px;
53
-
54
54
  pre {
55
55
  margin: 5px 0;
56
56
  }
@@ -62,7 +62,7 @@
62
62
  @extend .horizontal-box;
63
63
 
64
64
  .migrate {
65
- margin-left: 10px;
65
+ margin-left: 10px;
66
66
  }
67
67
  }
68
68
  }
@@ -7,10 +7,6 @@
7
7
  @extend .horizontal-box;
8
8
  margin-top: 5px;
9
9
 
10
- > div {
11
- margin: 0 2px;
12
- }
13
-
14
10
  .tables {
15
11
  @extend .vertical-box;
16
12
  @include box-flex(1);
@@ -19,6 +15,7 @@
19
15
  height: 500px;
20
16
  overflow-x: hidden;
21
17
  overflow-y: auto;
18
+ margin: 0 2px;
22
19
 
23
20
  .table {
24
21
  @extend .vertical-box;
@@ -104,6 +101,7 @@
104
101
  .migration_file {
105
102
  @extend .vertical-box;
106
103
  width: 500px;
104
+ margin: 0 2px;
107
105
 
108
106
  .migration_file_header {
109
107
  @extend .horizontal-box;
@@ -119,9 +117,14 @@
119
117
  .raw_content {
120
118
  @include box-flex(1);
121
119
  margin-top: 3px;
120
+
121
+ pre {
122
+ margin: 5px 0;
123
+ }
122
124
  textarea {
123
125
  width: 100%;
124
126
  height: 500px;
127
+ display: none;
125
128
  }
126
129
  }
127
130
 
@@ -1,3 +1,6 @@
1
+ /*
2
+ *= require github
3
+ */
1
4
  @import "compass";
2
5
 
3
6
  @import "base";
@@ -1,10 +1,11 @@
1
1
  module Ponytail
2
2
  class MigrationsController < ActionController::Base
3
3
  layout 'ponytail/application'
4
+ respond_to :html, only: [:index, :new]
5
+ respond_to :json, only: [:create, :destroy]
4
6
 
5
7
  def index
6
8
  @migrations = Migration.all
7
- @current_version = Migration.current_version
8
9
  end
9
10
 
10
11
  def new
@@ -13,36 +14,19 @@ module Ponytail
13
14
  end
14
15
 
15
16
  def create
16
- @migration = Migration.new(migraion_params)
17
-
18
- if @migration.save
19
- redirect_to :migrations, notice: 'Migration was successfully created.'
20
- else
21
- @schema = Schema.new
22
- render action: :new
23
- end
17
+ @migration = Migration.create(migraion_params)
18
+ flash[:notice] = "Migration was successfully created."
19
+ respond_with @migration
24
20
  end
25
21
 
26
22
  def destroy
27
- # TODO: fix params[:id]
28
- @migration = Migration.all.select { |x| x.version == params[:id].to_i }.first
29
- @migration.destroy
30
- redirect_to :migrations, notice: 'Migration was successfully deleted.'
31
- end
32
-
33
- def migrate
34
- if Migration.migrate
35
- redirect_to :migrations, notice: 'Migrate was succeed.'
36
- else
37
- redirect_to :migrations, notice: 'Migrate was failed.'
38
- end
39
- end
40
-
41
- def rollback
42
- if Migration.rollback
43
- redirect_to :migrations, notice: 'Rollback was succeed.'
23
+ @migration = Migration.find(params[:id].to_i)
24
+ if @migration
25
+ @migration.destroy
26
+ flash[:notice] = "Migration was successfully deleted."
27
+ respond_with @migration
44
28
  else
45
- redirect_to :migrations, notice: 'Rollback was failed.'
29
+ render nothing: true, status: 404
46
30
  end
47
31
  end
48
32
 
@@ -0,0 +1,27 @@
1
+ module Ponytail
2
+ class SchemasController < ActionController::Base
3
+ respond_to :json, only: [:show, :update]
4
+
5
+ def show
6
+ @schema = Schema.new
7
+ respond_with @schema
8
+ end
9
+
10
+ def update
11
+ # TODO, WIP:
12
+ @schema = Schema.new
13
+ if @schema.update(schema_params)
14
+ flash[:notice] = "Schema was successfully updated."
15
+ render json: @schema, status: :ok
16
+ else
17
+ flash[:notice] = "Schema update was failed."
18
+ render json: @schema, status: :bad_request
19
+ end
20
+ end
21
+
22
+ private
23
+ def schema_params
24
+ params.require(:ponytail_schema).permit(:version)
25
+ end
26
+ end
27
+ end
@@ -2,7 +2,7 @@
2
2
  <div class="header">
3
3
  <span>index</span>
4
4
  <span>|</span>
5
- <a href="/rails/migrations/new">new</a>
5
+ <a href="/ponytail/migrations/new">new</a>
6
6
  </div>
7
7
 
8
8
  <% if notice %>
@@ -13,18 +13,22 @@
13
13
  <% end %>
14
14
 
15
15
  <div class="container">
16
- <div>
17
- <!-- TODO: fake it! -->
18
- <% path = 'db/migrate/' %>
19
- <div class="migration_filepath"><%= path %></div>
16
+ <div class="left_div">
17
+ <div class="migration_filepath"><%= "#{Ponytail::Migration.migrations_path}/" %></div>
20
18
  <div class="migration_files">
21
19
  <table>
22
20
  <% @migrations.each do |migration| %>
23
- <tr>
24
- <td><%= migration.version == @current_version ? "*" : "" %></td>
25
- <!-- TODO: fake it!(sub) -->
26
- <td class="filename"><%= migration.filename.sub(path, "") %></td>
21
+ <% if migration.current? %>
22
+ <tr class="current">
23
+ <td>*</td>
24
+ <% else %>
25
+ <tr>
26
+ <td></td>
27
+ <% end %>
28
+ <td class="filename"><%= migration.filename_only %></td>
29
+ <td class="version"><%= migration.version %></td>
27
30
  <td class="raw_content"><%= migration.raw_content %></td>
31
+ <td class="delete_file"><a href="#">x</a></td>
28
32
  </tr>
29
33
  <% end %>
30
34
  </table>
@@ -33,10 +37,9 @@
33
37
 
34
38
  <div class="migration_file">
35
39
  <% migration = @migrations[0] %>
36
- <!-- TODO: fake it!(sub) -->
37
- <div class="migration_filename"><%= migration.filename.sub(path, "") %></div>
40
+ <div class="migration_filename"><%= migration.filename_only %></div>
38
41
  <div class="raw_content">
39
- <pre><%= migration.raw_content %></pre>
42
+ <pre><code><%= migration.raw_content %></code></pre>
40
43
  </div>
41
44
  </div>
42
45
  </div>
@@ -46,12 +49,20 @@
46
49
  <button class="new_button">New</button>
47
50
  </div>
48
51
  <div class="migrate">
49
- <button class="migrate_button" <%= Ponytail::Migration.check_pending? ? 'disabled="disabled"' : '' %>>Migrate</button>
50
- <button class="rollback_button" <%= Ponytail::Migration.check_pending? ? 'disabled="disabled"' : '' %>>Rollback</button>
52
+ <% if !Ponytail::Migration.check_pending? %>
53
+ <button class="migrate_button">Migrate</button>
54
+ <% else %>
55
+ <button class="migrate_button" disabled="disabled">Migrate</button>
56
+ <% end %>
57
+ <% if !Ponytail::Migration.check_pending? && !@migrations[0].current? %>
58
+ <button class="rollback_button">Rollback</button>
59
+ <% else %>
60
+ <button class="rollback_button" disabled="disabled">Rollback</button>
61
+ <% end %>
51
62
  </div>
52
63
  </div>
53
64
  </div>
54
65
 
55
66
  <script type='text/javascript'>
56
- new Ponytail.Views.Index({el: $(".index")}).render();
67
+ new Ponytail.Views.MigrationsIndex({el: $(".index")}).render();
57
68
  </script>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="new">
5
5
  <div class="header">
6
- <a href="/rails/migrations">index</a>
6
+ <a href="/ponytail/migrations">index</a>
7
7
  <span>|</span>
8
8
  <span>new</span>
9
9
  </div>
@@ -18,76 +18,33 @@
18
18
 
19
19
  <div class="container">
20
20
  <div class="tables">
21
- <% @schema.tables.each do |table| %>
22
- <div class="table">
23
- <div class="horizontal-box">
24
- <div class="table_name">
25
- <span><%= table.name %></span>
26
- <input type="text" value="<%= table.name %>" />
27
- </div>
28
- <div class="edit_table"><a href="#">edit</a></div>
29
- <div class="drop_table"><a href="#">drop</a></div>
30
- <div class="restore_table"><a href="#">restore</a></div>
31
- </div>
32
- <div class="columns">
33
- <% table.columns.each do |column| %>
34
- <div class="column">
35
- <div class="column_type">
36
- <span><%= column.type %></span>
37
- <select>
38
- <option value="string">string</option>
39
- <option value="text">text</option>
40
- <option value="integer">integer</option>
41
- <option value="float">float</option>
42
- <option value="decimal">decimal</option>
43
- <option value="datetime">datetime</option>
44
- <option value="timestamp">timestamp</option>
45
- <option value="time">time</option>
46
- <option value="date">date</option>
47
- <option value="binary">binary</option>
48
- <option value="boolean">boolean</option>
49
- </select>
50
- </div>
51
- <div class="column_name">
52
- <span><%= column.name %></span>
53
- <input type="text" value="<%= column.name %>" />
54
- </div>
55
- <div class="remove_column"><a href="#">remove</a></div>
56
- <div class="restore_column"><a href="#">restore</a></div>
57
- </div>
58
- <% end %>
59
- <div class="add_column"><a href="#">Add Column</a></div>
60
- </div>
61
- </div>
62
- <% end %>
63
21
  <div class="new_table"><a href="#">New Table</a></div>
64
22
  </div>
65
23
 
66
- <%= form_for @migration, url: migrations_path do |f| %>
67
- <div class="migration_file">
68
- <div class="migration_file_header">
69
- <div class="classname">
70
- <input type="text" name="ponytail_migration[name]" value="NewMigration" />
71
- </div>
72
-
73
- <div class="edit_checkbox">
74
- <input type="checkbox" />
75
- <span>edit</span>
76
- </div>
24
+ <div class="migration_file">
25
+ <div class="migration_file_header">
26
+ <div class="classname">
27
+ <input type="text" value="NewMigration" />
77
28
  </div>
78
29
 
79
- <div class="raw_content">
80
- <textarea name="ponytail_migration[raw_content]" disabled="disabled"></textarea>
30
+ <div class="edit_checkbox">
31
+ <input type="checkbox" />
32
+ <span>edit</span>
81
33
  </div>
34
+ </div>
82
35
 
83
- <div class="actions">
84
- <button class="create_button" <%= Ponytail::Migration.check_pending? ? 'disabled="disabled"' : '' %>>Create File</button>
85
- </div>
36
+ <div class="raw_content">
37
+ <pre><code></code></pre>
38
+ <textarea></textarea>
86
39
  </div>
87
- <% end %>
40
+
41
+ <div class="actions">
42
+ <button class="create_button" <%= Ponytail::Migration.check_pending? ? 'disabled="disabled"' : '' %>>Create File</button>
43
+ </div>
44
+ </div>
88
45
  </div>
89
46
  </div>
90
47
 
91
48
  <script type='text/javascript'>
92
- new Ponytail.Views.New({el: $(".new")}).render();
49
+ new Ponytail.Views.MigrationsNew({el: $(".new")}).render();
93
50
  </script>