Partial Fix #5560 - Gitlive - branching wip
[gitlive] / old_seed_version / Commit.bjs
1 {
2  "name" : "Commit",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/gitlive/old_seed_version/Commit.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "build_module" : "",
9  "items" : [
10   {
11    "listeners" : {
12     "response" : "function (self, id) {\n  // hide\n     //if (id < 1) {\n        this.el.hide();\n        return;\n    //}\n    if (typeof(this.get('bug').getValue()) != 'object') {\n        print(\"ERROR\");\n        return;\n    }\n \n    this.el.hide();\n        \n    //var val = this.get('bug').getValue();\n     //   Seed.print(val);\n}",
13     "destroy_event" : "function (self, event) {\n     this.el.hide();\n                return false;\n}"
14    },
15    "default_width" : 800,
16    "$ deletable" : true,
17    "title" : "Commit",
18    "xtype" : "Dialog",
19    "default_height" : 500,
20    " modal" : true,
21    "$ modal" : true,
22    "$ show" : "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    \n    \n    this.files = c.files;\n    this.release = c.release;\n    this.rev = c.rev;\n    \n    this.repo = c.repo;\n\n    this.get('/commitDate').el.set_text(c.changed);\n    this.get('/commitAuthor').el.set_text(c.author);\n    this.get('/commitMsg').el.get_buffer().set_text('');\n    this.get('/commitPatch').showDiff(c.files);\n    \n    this.el.show_all();\n    \n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return false;\n    }\n    var buf = this.get('/commitMsg').el.get_buffer();\n    var e = {};\n    var s = {};\n    buf.get_start_iter(s);\n    buf.get_end_iter(e);\n    \n    var ret=  {\n        date :  this.get('/commitDate').el.get_text(),\n        author :  this.get('/commitAuthor').el.get_text(),\n        message : buf.get_text(s.value, e.value, false)\n    };\n \n    return ret;\n    \n    \n    \n}\n",
23    "$ xns" : "Gtk",
24    "border_width" : 3,
25    "items" : [
26     {
27      "xtype" : "VBox",
28      "$ pack" : " function(p,e) {\n        p.el.get_content_area().pack_start(e.el,true,true,10);\n    }\n",
29      "$ xns" : "Gtk",
30      "items" : [
31       {
32        "* pack" : "pack_start,false,true,2",
33        "xtype" : "HBox",
34        "$ xns" : "Gtk",
35        "items" : [
36         {
37          "label" : "Fixes",
38          "* pack" : "pack_start,false,false,10",
39          "xtype" : "Label",
40          "width_request" : 50,
41          "$ xns" : "Gtk"
42         },
43         {
44          "listeners" : {
45           "changed" : "function (self) {\n   var val = this.el.get_child().get_text();\n   print(JSON.stringify(val));\n   if (!val.length) {\n       return;\n   }\n   \n   var name = this.get('/remoteName').el.get_text();\n   if (name.length) {\n       return;\n   }\n   // fill in name\n   var val = imports.Scm.Git.Repo.Repo.parseURL(val);\n   if ((typeof(val.host) != 'undefined') && val.host.length) {\n       var host = val.host;\n       // need to add github owner...\n        if (host.match(/github.com$/)) {\n          host += '.' + val.path.split('/').shift();\n        }\n   \n   \n        this.get('/remoteName').el.set_text(host);\n   }\n    \n   \n}"
46          },
47          "id" : "commitFixes",
48          "* init" : "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
49          "xtype" : "ComboBox",
50          "$ xns" : "Gtk",
51          "$ load" : "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var working = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'working') {\n            working = i;\n        }          \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (working !== false) {\n        this.el.set_active(working);\n    }\n    \n}",
52          "items" : [
53           {
54            "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
55            "xtype" : "ListStore",
56            "$ xns" : "Gtk",
57            "* prop" : "model"
58           }
59          ]
60         }
61        ]
62       },
63       {
64        "* pack" : "pack_start,false,true,2",
65        "xtype" : "HBox",
66        "$ xns" : "Gtk",
67        "items" : [
68         {
69          "label" : "Date",
70          "xalign" : 1,
71          "* pack" : "pack_start,false,false,10",
72          "xtype" : "Label",
73          "width_request" : 50,
74          "$ xns" : "Gtk"
75         },
76         {
77          "id" : "commitDate",
78          "xtype" : "Entry",
79          "$ xns" : "Gtk"
80         }
81        ]
82       },
83       {
84        "* pack" : "pack_start,false,true,2",
85        "xtype" : "HBox",
86        "$ xns" : "Gtk",
87        "items" : [
88         {
89          "label" : "Author",
90          "xalign" : 1,
91          "* pack" : "pack_start,false,false,10",
92          "xtype" : "Label",
93          "width_request" : 50,
94          "$ xns" : "Gtk"
95         },
96         {
97          "id" : "commitAuthor",
98          "xtype" : "Entry",
99          "$ xns" : "Gtk"
100         }
101        ]
102       },
103       {
104        "* pack" : "pack_start,false,false,2",
105        "xtype" : "HBox",
106        "$ xns" : "Gtk",
107        "items" : [
108         {
109          "label" : "Message",
110          "xalign" : 1,
111          "* pack" : "pack_start,false,false,10",
112          "xtype" : "Label",
113          "width_request" : 50,
114          "$ xns" : "Gtk"
115         },
116         {
117          "id" : "commitMsg",
118          "* pack" : "add",
119          "xtype" : "TextView",
120          "$ xns" : "Gtk",
121          "height_request" : 100
122         }
123        ]
124       },
125       {
126        "* init" : "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
127        "xtype" : "ScrolledWindow",
128        "* pack" : "pack_end,true,true,0",
129        "$ xns" : "Gtk",
130        "height_request" : 200,
131        "items" : [
132         {
133          "$ clear" : "function() {\n    \n    \n    \n     \n   // remove..\n    var s  = \"document.body.textContent='';\"\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
134          "id" : "commitPatch",
135          "xtype" : "WebView",
136          "* pack" : "add",
137          "$ showDiff" : "function(files) {\n    this.clear();\n    \n    \n    \n    if (Commit.release === false) {\n        return;\n    }\n    \n    var diff = Commit.repo.diff(files, Commit.release, Commit.rev);\n    \n   // remove..\n    var s  = \"var pre  = document.createElement('pre'); document.body.appendChild(pre);\";\n    s += \"pre.textContent =  \" +\n             JSON.stringify(Commit.repo.lastCmd + \"\\n\") + '+  ' + \n             JSON.stringify(diff) + \";\";\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
138          "$ xns" : "WebKit"
139         }
140        ]
141       }
142      ]
143     },
144     {
145      "label" : "Cancel",
146      "xtype" : "Button",
147      "* pack" : "add_action_widget,0",
148      "$ xns" : "Gtk"
149     },
150     {
151      "label" : "Add",
152      "id" : "ok_button",
153      "* pack" : "add_action_widget,1",
154      "xtype" : "Button",
155      "$ xns" : "Gtk"
156     }
157    ]
158   }
159  ]
160 }