View | Details | Raw Unified | Return to bug 23388
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/css/preferences.css (+17 lines)
Lines 134-137 span.overridden { Link Here
134
    border: 1px solid #EEE;
134
    border: 1px solid #EEE;
135
    margin: 1em 1em 1em 0;
135
    margin: 1em 1em 1em 0;
136
    resize:  vertical;
136
    resize:  vertical;
137
}
138
139
.name-cell:target {
140
    background-color: #FFC;
141
}
142
143
.permalink {
144
    bottom: 0;
145
    display: inline-block;
146
    padding: 5px;
147
    position: absolute;
148
    right: 0;
149
}
150
151
.pref-cell > div {
152
    padding-right: 1em;
153
    position: relative;
137
}
154
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-3 / +12 lines)
Lines 52-60 Link Here
52
            [% ELSE %]
52
            [% ELSE %]
53
            [% IF ( loop.first ) %]<table class="preferences"><thead><tr><th>Preference</th><th>Value</th></tr></thead><tbody>[% END %]
53
            [% IF ( loop.first ) %]<table class="preferences"><thead><tr><th>Preference</th><th>Value</th></tr></thead><tbody>[% END %]
54
            <tr class="name-row">
54
            <tr class="name-row">
55
                <td class="name-cell">
55
                <td id="link_[% FOREACH NAME IN LINE.NAMES %][% NAME.name | html %][% UNLESS ( loop.last ) %]__[% END %][% END %]" class="name-cell">
56
                    <code>
56
                    <code>
57
                        [% SET is_pref = 0 %]
57
                        [% FOREACH NAME IN LINE.NAMES %]
58
                        [% FOREACH NAME IN LINE.NAMES %]
59
                            [% SET is_pref = 1 %]
58
						<label for="pref_[% NAME.name | html %]">
60
						<label for="pref_[% NAME.name | html %]">
59
							[% IF ( NAME.jumped ) %]
61
							[% IF ( NAME.jumped ) %]
60
							<span class="term" id="jumped">[% NAME.name | html %]</span>
62
							<span class="term" id="jumped">[% NAME.name | html %]</span>
Lines 74-80 Link Here
74
                        [% END %]
76
                        [% END %]
75
                    </code>
77
                    </code>
76
                </td>
78
                </td>
77
                <td><div>
79
                <td class="pref-cell">
80
                    <div>
78
                    [% FOREACH CHUNK IN LINE.CHUNKS %]
81
                    [% FOREACH CHUNK IN LINE.CHUNKS %]
79
                    [% IF ( CHUNK.type_text ) %]
82
                    [% IF ( CHUNK.type_text ) %]
80
                    [% CHUNK.contents | $raw %]
83
                    [% CHUNK.contents | $raw %]
Lines 143-149 Link Here
143
                        </ul> <!-- / ul.sortable -->
146
                        </ul> <!-- / ul.sortable -->
144
                    [% END %]
147
                    [% END %]
145
                    [% END %]
148
                    [% END %]
146
                </div></td>
149
                    [% IF ( is_pref ) %]
150
                        <a class="permalink" style="display:none"  data-toggle="tooltip" data-placement="left" title="Copy link to this preference" href="[%  Koha.Preference("staffClientBaseURL") | uri %]/cgi-bin/koha/admin/preferences.pl?tab=[% TAB.tab_id | uri %]#link_[% FOREACH NAME IN LINE.NAMES %][% NAME.name | html %][% UNLESS ( loop.last ) %]__[% END %][% END %]"><i class="fa fa-link fa-rotate-180"></i></a>
151
                    [% END %]
152
                </div>
153
            </td>
147
            </tr>
154
            </tr>
148
            [% IF ( loop.last ) %]</tbody></table>[% END %]
155
            [% IF ( loop.last ) %]</tbody></table>[% END %]
149
            [% END %]
156
            [% END %]
Lines 212-217 Link Here
212
        var MSG_ALL_VALUE_WARN = _("Note: _ALL_ value will override all other values");
219
        var MSG_ALL_VALUE_WARN = _("Note: _ALL_ value will override all other values");
213
        var MSG_UPD_LOC_FORMAT_WARN = _("The following values are not formatted correctly:");
220
        var MSG_UPD_LOC_FORMAT_WARN = _("The following values are not formatted correctly:");
214
        var MSG_INVALID = _( "Error: presence of invalid data prevent saving. Please make the corrections and try again." );
221
        var MSG_INVALID = _( "Error: presence of invalid data prevent saving. Please make the corrections and try again." );
222
        var MSG_COPY_TO_CLIPBOARD = _( "Copy link to this preference" );
223
        var MSG_COPIED_TO_CLIPBOARD = _( "Link copied to the clipboard" );
215
    </script>
224
    </script>
216
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
225
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
217
    [% Asset.js("js/ajax.js") | $raw %]
226
    [% Asset.js("js/ajax.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-2 / +19 lines)
Lines 1-4 Link Here
1
/* global KOHA MSG_MADE_CHANGES CodeMirror MSG_CLICK_TO_EXPAND MSG_CLICK_TO_COLLAPSE to_highlight search_jumped humanMsg MSG_NOTHING_TO_SAVE MSG_MODIFIED MSG_SAVING MSG_SAVED_PREFERENCE dataTablesDefaults */
1
/* global KOHA MSG_MADE_CHANGES CodeMirror MSG_CLICK_TO_EXPAND MSG_CLICK_TO_COLLAPSE to_highlight search_jumped humanMsg MSG_NOTHING_TO_SAVE MSG_MODIFIED MSG_SAVING MSG_SAVED_PREFERENCE dataTablesDefaults copyToClipboard MSG_COPIED_TO_CLIPBOARD MSG_COPY_TO_CLIPBOARD */
2
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX
2
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX
3
3
4
KOHA.Preferences = {
4
KOHA.Preferences = {
Lines 68-73 $( document ).ready( function () { Link Here
68
        KOHA.Preferences.Modified = true;
68
        KOHA.Preferences.Modified = true;
69
    }
69
    }
70
70
71
    $(".pref-cell").on("hover", function(){
72
        $(this).find(".permalink").toggle();
73
    });
74
71
    $( '.prefs-tab' )
75
    $( '.prefs-tab' )
72
        .find( 'input.preference, textarea.preference' ).on('input', function () {
76
        .find( 'input.preference, textarea.preference' ).on('input', function () {
73
            if ( this.defaultValue === undefined || this.value != this.defaultValue ) mark_modified.call( this );
77
            if ( this.defaultValue === undefined || this.value != this.defaultValue ) mark_modified.call( this );
Lines 205-208 $( document ).ready( function () { Link Here
205
            email: true
209
            email: true
206
        });
210
        });
207
    });
211
    });
208
} );
212
213
    $(".permalink").on("click", function(e){
214
        e.preventDefault();
215
        copyToClipboard( $(this).attr("href") );
216
        $(this).attr("data-original-title", MSG_COPIED_TO_CLIPBOARD )
217
            .tooltip("show");
218
    });
219
220
    $(".permalink").tooltip({
221
        delay: { "show": 100, "hide": 500 }
222
    }).on("hidden.bs.tooltip", function(){
223
        $(this).attr("data-original-title", MSG_COPY_TO_CLIPBOARD );
224
    });
225
});
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +13 lines)
Lines 232-234 function keep_text(clicked_index) { Link Here
232
        searchboxes[i].value = persist;
232
        searchboxes[i].value = persist;
233
    }
233
    }
234
}
234
}
235
- 
235
236
// https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f
237
function copyToClipboard( text ){
238
    var el = document.createElement("textarea");  // Create a <textarea> element
239
    el.value = text;                                 // Set its value to the string that you want copied
240
    el.setAttribute("readonly", "");                // Make it readonly to be tamper-proof
241
    el.style.position = "absolute";
242
    el.style.left = "-9999px";                      // Move outside the screen to make it invisible
243
    document.body.appendChild(el);                  // Append the <textarea> element to the HTML document
244
    el.select();                                    // Select the <textarea> content
245
    document.execCommand("copy");                   // Copy - only works as a result of a user action (e.g. click events)
246
    document.body.removeChild(el);                  // Remove the <textarea> element
247
}

Return to bug 23388