Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a9cc182f

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID a9cc182f3613fd21a698c9f40b8c5908d92c9da5
  • Vorgänger 920773a2
  • Nachfolger 5187eea8

Pflichtenhefte: Statischen JavaScript-Code nach js/requirement_spec.js verschieben

Unterschiede anzeigen:

js/requirement_spec.js
178 178
    $('#text-block-' + id).show();
179 179
}
180 180

  
181
function ask_delete_text_block(key, opt) {
182
  if (confirm(kivi.t8("Are you sure?")))
183
    standard_text_block_ajax_call(key, opt);
184
  return true;
185
}
186

  
181 187
// --------------------------------------------------------------------------------
182 188
// ------------------------------ sections and items ------------------------------
183 189
// --------------------------------------------------------------------------------
......
248 254
  if (options.to_hide_if_empty && (1 == $(options.to_hide_if_empty).children().size()))
249 255
    $(options.to_hide_if_empty).hide();
250 256
}
257

  
258
function ask_delete_item(key, opt) {
259
  if (confirm(kivi.t8("Are you sure?")))
260
    standard_item_ajax_call(key, opt);
261
  return true;
262
}
263

  
264
function create_requirement_spec_context_menus() {
265
  $.contextMenu({
266
    selector: '.text-block-context-menu',
267
    items: {
268
        add:    { name: kivi.t8('Add text block'),    icon: "add",    callback: standard_text_block_ajax_call }
269
      , edit:   { name: kivi.t8('Edit text block'),   icon: "edit",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }
270
      , delete: { name: kivi.t8('Delete text block'), icon: "delete", callback: ask_delete_text_block,         disabled: disable_edit_text_block_commands }
271
      , sep1:   "---------"
272
      , flag:   { name: kivi.t8('Toggle marker'),     icon: "flag",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }
273
      , sep2:   "---------"
274
      , copy:   { name: kivi.t8('Copy'),              icon: "copy",                                            disabled: function() { return true; } }
275
      , paste:  { name: kivi.t8('Paste'),             icon: "paste",                                           disabled: function() { return true; } }
276
      // , copy:   { name: kivi.t8('Copy'),              icon: "copy",                                            disabled: disable_edit_text_block_commands }
277
      // , paste:  { name: kivi.t8('Paste'),             icon: "paste",                                           disabled: disable_edit_text_block_commands }
278
    }
279
  });
280

  
281
  $.contextMenu({
282
    selector: '.section-context-menu',
283
    items: {
284
        add_section:        { name: kivi.t8('Add section'),        icon: "add",    callback: standard_item_ajax_call }
285
      , add_function_block: { name: kivi.t8('Add function block'), icon: "add",    callback: standard_item_ajax_call, disabled: disable_add_function_block_command }
286
      , sep1:               "---------"
287
      , edit:               { name: kivi.t8('Edit'),               icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
288
      , delete:             { name: kivi.t8('Delete'),             icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands }
289
      , sep2:               "---------"
290
      , flag:               { name: kivi.t8('Toggle marker'),      icon: "flag",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
291
      , sep3:               "---------"
292
      , copy:               { name: kivi.t8('Copy'),               icon: "copy",                                      disabled: function() { return true; } }
293
      , paste:              { name: kivi.t8('Paste'),              icon: "paste",                                     disabled: function() { return true; } }
294
      // , copy:               { name: kivi.t8('Copy'),               icon: "copy",                                      disabled: disable_edit_item_commands }
295
      // , paste:              { name: kivi.t8('Paste'),              icon: "paste",                                     disabled: disable_edit_item_commands }
296
    }
297
  });
298

  
299
  $.contextMenu({
300
    selector: '.function-block-context-menu,.sub-function-block-context-menu',
301
    items: {
302
        add_function_block:     { name: kivi.t8('Add function block'),     icon: "add",    callback: standard_item_ajax_call }
303
      , add_sub_function_block: { name: kivi.t8('Add sub function block'), icon: "add",    callback: standard_item_ajax_call }
304
      , sep1:                   "---------"
305
      , edit:                   { name: kivi.t8('Edit'),                   icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
306
      , delete:                 { name: kivi.t8('Delete'),                 icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands }
307
      , sep2:                   "---------"
308
      , flag:                   { name: kivi.t8('Toggle marker'),          icon: "flag",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
309
      , sep3:                   "---------"
310
      , copy:                   { name: kivi.t8('Copy'),                   icon: "copy",                                      disabled: function() { return true; } }
311
      , paste:                  { name: kivi.t8('Paste'),                  icon: "paste",                                     disabled: function() { return true; } }
312
      // , copy:                   { name: kivi.t8('Copy'),                   icon: "copy",                                      disabled: disable_edit_item_commands }
313
      // , paste:                  { name: kivi.t8('Paste'),                  icon: "paste",                                     disabled: disable_edit_item_commands }
314
    }
315
  });
316
}

Auch abrufbar als: Unified diff