Commit 3e2e9b57f901b8832a30591d02b8d4c4ec43850d

Authored by totoro
1 parent 2a59cd12

Start to replace old checkbox for campaign report by jq_checkbox with ajax call

Showing 1 changed file with 74 additions and 0 deletions   Show diff stats
web/jQuery/CXM_jq_checkbox.anubis 0 → 100644
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: フランスのトトロ
  4 + * Date: 28/06/2015
  5 + * Time: 02:22
  6 + * © Calexium
  7 + */
  8 +
  9 +transmit calexium_lib/web/CXM_making_a_web_site.anubis
  10 +transmit calexium_lib/web/CXM_jquery.anubis
  11 +transmit calexium_lib/web/jQuery/CXM_jquery_button.anubis
  12 +transmit calexium_lib/web/jQuery/CXM_jquery_icons.anubis
  13 +transmit calexium_lib/web/js_tools.anubis
  14 +transmit tools/basis.anubis
  15 +transmit system/string.anubis
  16 +transmit tools/random.anubis
  17 +
  18 +define String
  19 + checkbox_init_script
  20 + (
  21 + String checkbox_id,
  22 + Bool initial_state
  23 + ) =
  24 + "var checkbox = $('#" + checkbox_id + "');" +
  25 + if initial_state then
  26 + "checkbox.addClass('checked');"
  27 + else
  28 + "checkbox.addClass('unchecked');".
  29 +
  30 +define String
  31 + checkbox_onclick_script
  32 + (
  33 + String checkbox_id,
  34 + String on_script,
  35 + String off_script,
  36 + ) =
  37 + "var checkbox = $('#" + checkbox_id + "');
  38 + checkbox.toggleClass('checked');
  39 + checkbox.toggleClass('unchecked');
  40 + if (checkbox.hasClass('checked')) {
  41 + " + on_script + "
  42 + } else {
  43 + " + off_script + "
  44 + }".
  45 +
  46 +public define HTML_Partial_Content
  47 + jq_img_checkbox
  48 + (
  49 + String checkbox_id,
  50 + Bool initial_state,
  51 + String image_url,
  52 + String checkbox_label,
  53 + String on_script,
  54 + String off_script,
  55 + Icon_orientation orientation
  56 + ) =
  57 + partial_content(
  58 + [
  59 + js_inline(jquery_ready(checkbox_init_script(checkbox_id, initial_state)))
  60 + ],
  61 + jquery_button(jquery_img_button(image_url, checkbox_label, checkbox_id, jQuery_actioner(same, jqscript, checkbox_onclick_script(checkbox_id, on_script, off_script)), orientation))
  62 + ).
  63 +
  64 +public define HTML_Partial_Content
  65 + jq_img_checkbox
  66 + (
  67 + String checkbox_id,
  68 + Bool initial_state,
  69 + String image_url,
  70 + String checkbox_label,
  71 + String script,
  72 + Icon_orientation orientation
  73 + ) =
  74 + jq_img_checkbox(checkbox_id, initial_state, image_url, checkbox_label, script, script, orientation).
... ...