From afc52db89ac76ac04a8a994b3d2f759f5c28cc92 Mon Sep 17 00:00:00 2001 From: Anthony Johnson Date: Thu, 6 Jul 2023 17:59:36 -0700 Subject: [PATCH] Some additions to the project import configuration page I pulled down #166 to provide a bit of guidance, but ended up with fixes to the PR either way. I added a few features on top, to replace plain text with visual elements and interactive components. These aren't fully working yet (the example selector namely, see #184). --- .../static/readthedocsext/theme/js/site.js | 2 +- .../theme/templates/projects/import_base.html | 95 +++++++++---------- .../templates/projects/import_config.html | 73 ++++++++++---- src/js/application/index.js | 7 +- 4 files changed, 107 insertions(+), 70 deletions(-) diff --git a/readthedocsext/theme/static/readthedocsext/theme/js/site.js b/readthedocsext/theme/static/readthedocsext/theme/js/site.js index 89b0cb45..bf0c63a5 100644 --- a/readthedocsext/theme/static/readthedocsext/theme/js/site.js +++ b/readthedocsext/theme/static/readthedocsext/theme/js/site.js @@ -1 +1 @@ -!function(e){function t(t){for(var n,a,u=t[0],c=t[1],s=t[2],f=0,b=[];fe.length)&&(t=e.length);for(var r=0,n=new Array(t);r=h[o];t.device[o](i)}}));var r=a()(window),n=function(){t.viewport_width(r.width())};r.on("resize",n),n()})),y=function(){function e(t){b(this,e),this.id=t.id,this.url=t.url,this.loaded=o.a.observable(!1),this.loading=o.a.observable(!1),this.promise=null,this.data=o.a.observable()}return l(e,[{key:"fetch",value:function(){var e=this;if(this.promise)return this.promise;this.promise=new Promise((function(t,r){if(e.loaded())return t(e.data());e.loading(!0),a.a.getJSON(e.url).then((function(r){return e.data(r),e.loaded(!0),e.loading(!1),t(r)}))}))}}]),e}(),_=l((function e(){var t=this;b(this,e),this.config=o.a.observable(),this.search_project_config=o.a.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=new URL(e.api_projects_list_url,window.location.origin);r.search="?name={query}",t.search_project_config({type:"category",apiSettings:{url:r.href,onResponse:function(e){return{results:{"category-projects":{name:"Projects",results:e.results.map((function(e,t){var r=e.slug;e.subproject_of?r="Subproject of "+e.subproject_of.name:e.translation_of&&(r=e.language.name+" translation of "+e.translation_of.name);var n=new URL(e.urls.home),o=new URL(window.location.href);return n.hostname!=o.hostname&&(n.hostname=o.hostname),{title:e.name,description:r,url:n.toString()}}))}}}}},minCharacters:2})}}))}));d=_,v="HeaderView",(p=f(p="view_name"))in d?Object.defineProperty(d,p,{value:v,enumerable:!0,configurable:!0,writable:!0}):d[p]=v,u.a.add_view(_)},,function(e,t,r){"use strict";r(1)},function(e,t,r){"use strict";(function(e,n){r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return b}));var o=r(1),i=r.n(o),a=r(0),u=r.n(a);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?i-1:0),u=1;u select").dropdown({placeholder:""}),o()("[data-content]:not([data-semanticui-popup])").popup({position:"top center",delay:{show:500},variation:"small"}),o()(".ui.menu > .item[data-tab]").tab(),new a.a(".ui.button[data-clipboard-text]"),o()(".ui.button[data-clipboard-text]").popup({on:"click",hoverable:!1})}}])&&f(n.prototype,i),l&&f(n,l),Object.defineProperty(n,"prototype",{writable:!1}),t}()}).call(this,r(7))},,function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r.n(n),i=r(1),a=r.n(i);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"body";console.debug("Attaching application to selector:",e),o.a.applyBindings(this,a()(e)[0])}},{key:"show_modal",value:function(e){return function(t,r){var n="[data-modal-id="+e+"]";console.debug("Showing modal:",n),0===a()(n).modal("show").length&&console.debug("Modal not found:",n)}}},{key:"post_child_form",value:function(e,t){var r=t.currentTarget.querySelector(":scope > form");return r&&r.submit(),!1}}])&&c(t.prototype,r),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},,,,function(e,t,r){r(15),e.exports=r(16)},function(e,t,r){},function(e,t,r){"use strict";r.r(t);var n=r(1),o=r.n(n),i=r(8);o()(document).ready((function(){(new i.a).run()}))},,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";var n=r(1),o=r.n(n),i=r(0),a=r.n(i),u=r(2);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0)setTimeout(n,2e3);else{var o=e.statusText;e.responseJSON&&(o=e.responseJSON.detail),t.reject({message:o})}}))}),2e3),t})(e).then((function(){t.resolve()})).fail((function(e){t.reject(e)}))},error:function(e){var r=e.responseJSON.detail||e.statusText;t.reject({message:r})}}),t}h(w,"view_name","ProjectTrafficAnalyticsView"),u.a.add_view(w);r(5);var j=r(3);function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function P(e,t){return(P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=T(e);if(t){var o=T(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return k(this,r)}}function k(e,t){if(t&&("object"===O(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function E(e,t){for(var r=0;r0}))})),B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}(r,e);var t=x(r);function r(){var e;return R(this,r),(e=t.call(this)).config=o.a.observable(),e.search_config=o.a.observable(),e.selected=o.a.observable(),e.is_loading=o.a.observable(!1),e.is_syncing=o.a.observable(!1),e.is_selected=o.a.computed((function(){return void 0!==e.selected()})),e.error=o.a.observable(),e.config.subscribe((function(t){void 0!==t&&e.init_search()})),e}return A(r,[{key:"sync_remote_repos",value:function(){var e=this,t=this.config(),r={url:t.urls.api_sync_remote_repositories,token:t.csrf_token};return this.is_syncing(!0),this.is_loading(!0),S(r).fail((function(t){console.error("Error syncing remote repositories:",t.message),e.error(t.message)})).always((function(){e.is_syncing(!1),e.is_loading(!1)}))}},{key:"init_search",value:function(){var e=this,t=this.config().urls.remoterepository_list+"?full_name={query}";this.search_config({type:"knockout",templates:{knockout:function(e){var t=a()("
");o.a.applyBindingsToNode(t[0],{template:{name:"remote-repo-results",data:{remote_repos:e.results.map((function(e){return new D(e)}))}}});var r=t.html();return t.remove(),r}},apiSettings:{url:t},selector:{prompt:".ui.text",title:".title .text"},fullTextSearch:!0,onSelect:function(t,r){e.selected(new D(t))}})}}]),r}(j.b);function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&L(e,t)}function L(e,t){return(L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function $(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=M(e);if(t){var o=M(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return J(this,r)}}function J(e,t){if(t&&("object"===H(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var r=0;r0&&void 0!==arguments[0]&&arguments[0];U(this,e),this.is_expanded=o.a.observable(r),this.dropdown_class=o.a.computed((function(){return t.is_expanded()?"fa-caret-down":"fa-ellipsis"}))}return F(e,[{key:"toggle_expanded",value:function(){var e=this.is_expanded();this.is_expanded(!e)}}]),e}();W(G,"view_name","ProjectHeaderView"),u.a.add_view(G);var K=function(){function e(){var t=this;U(this,e),this.projects=o.a.observableArray(),this.config=o.a.observable(),this.filter_project_config=o.a.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=e.api_url+"?name={query}";e.errors;t.filter_project_config({apiSettings:{url:r,cache:!1},throttle:500,fields:{name:"name",value:"slug"},saveRemoteData:!1,filterRemoteData:!1,sortSelect:!0,onChange:function(e,t,r){window.location.href="?project="+e}})}})),this.filter_config={action:"select",onChange:function(e,t,r){r.closest("form").submit()}}}return F(e,[{key:"project",value:function(e){var t=new X(e);return this.projects.push(t),t}}]),e}();W(K,"view_name","ProjectListView"),u.a.add_view(K);var X=function(e){q(r,e);var t=$(r);function r(e){var n;return U(this,r),(n=t.call(this,e)).url_docs=o.a.observable(),n.data.subscribe((function(e){n.url_docs(e.canonical_url)})),n}return F(r)}(j.a),Y=function(){function e(){var t=this;U(this,e),this.config=o.a.observable(),this.is_loading=o.a.observable(!1),this.search_config=o.a.computed((function(){var e=t.config();if(void 0!==e)return t.init_search(e)}))}return F(e,[{key:"init_search",value:function(e){return{apiSettings:{url:e.api_url+"?verbose_name={query}"},selector:{prompt:".ui.text"},fields:{title:"verbose_name",description:"identifier"},fullTextSearch:!0,onSelect:function(e,t){window.location.href=e.urls.dashboard.edit},error:e.errors||{}}}}]),e}();W(Y,"view_name","ProjectVersionCreateView"),u.a.add_view(Y);var Z=function(){function e(){var t=this;U(this,e),this.versions=o.a.observableArray(),this.config=o.a.observable(),this.filter_version_config=o.a.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=e.api_url+"?verbose_name={query}&active=True";e.errors;t.filter_version_config({apiSettings:{url:r,cache:!1,onResponse:function(e){return{results:e.results.map((function(e){return console.dir(e),{name:e.verbose_name,value:e.slug}}))}}},throttle:500,saveRemoteData:!1,filterRemoteData:!1,sortSelect:!0,onChange:function(e,t,r){window.location.href="?version="+e}})}})),this.filter_config={action:"select",onChange:function(e,t,r){r.closest("form").submit()}}}return F(e,[{key:"attach_add_version",value:function(){return console.debug(arguments),{}}},{key:"version",value:function(e){var t=new ee(e);return this.versions.push(t),t}}]),e}();W(Z,"view_name","ProjectVersionListView"),u.a.add_view(Z);var ee=function(e){q(r,e);var t=$(r);function r(e){var n;return U(this,r),(n=t.call(this,e)).url_pdf=o.a.observable(),n.url_epub=o.a.observable(),n.url_html=o.a.observable(),n.url_docs=o.a.observable(),n.is_built=o.a.observable(!0),n.data.subscribe((function(e){n.url_pdf(e.downloads.pdf),n.url_epub(e.downloads.epub),n.url_html(e.downloads.html),n.url_docs(e.urls.documentation),n.is_built(e.built)})),n}return F(r,[{key:"trigger_build",value:function(e,t){return function(r,n){a.a.ajax({type:"POST",url:e,data:{csrfmiddlewaretoken:t}}).then((function(e){e.build.urls.build?window.location.href=e.build.urls.build:console.debug("Redirect to new build failed")})).catch((function(e){console.error(e)}))}}}]),r}(j.a)},function(e,t,r){"use strict";var n=r(1),o=r.n(n),i=r(0),a=r.n(i),u=r(4),c=r.n(u),s=r(11),l=r.n(s),f=r(12),b=r.n(f),d=r(13),p=r.n(d),v=r(2);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return _(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&r.is_expanded(!0)})),this.output=a.a.observable(),this.output_lines=a.a.computed((function(){return r.output().split(/\n/).map((function(e,t){return new k({command:r,output:e,line_number:t+1})}))}),null,{deferEvaluation:!0}),this.output(t.output)}return w(e,[{key:"color_output",value:function(e){return Promise.all([r.e(0).then(r.t.bind(null,45,7)).then((function(e){return e.default})),r.e(4).then(r.t.bind(null,46,7)).then((function(e){return e.default}))]).then((function(t){var r,n,o=m(t,2);r=o[0],n=o[1];var i=new r;return i.use_classes=!0,e=n(e=i.ansi_to_html(e),{allowedTags:["span"],allowedAttributes:{span:["class"]}})}))}},{key:"toggle_expanded",value:function(){return this.is_expanded(!this.is_expanded()),!1}}]),e}(),E=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};j(this,e),this.id=r.id,this.api_url="/api/v2/build/",this.success=a.a.observable(r.success),this.error=a.a.observable(r.error),this.state=a.a.observable(r.state),this.state_display=a.a.observable(r.state_display),this.finished=a.a.computed((function(){return["finished","cancelled"].includes(t.state())})),this.is_loading=a.a.observable(!0),this.progress_config=a.a.computed((function(){var e=t.state(),r=["triggered","queued","cloning","installing","building","uploading","finished"];if(a.a.computedContext.isInitial())return{autoSuccess:!1,value:r.indexOf(e),total:r.length-1,label:t.state_display()};if(t.finished()){var n="cancelled"===e,o=t.error()||!1===t.success();return n?function(e){e("set warning","Build cancelled")}:o?function(e){e("set error","Build failed")}:function(e){e("set success","Build succeeded")}}return function(n){n("set progress",r.indexOf(e)),n("set label",t.state_display())}})).extend({deferred:!0}),this.date=a.a.observable(r.date),this.length=a.a.observable(r.length),this.date_display=a.a.observable(),this.date_display_since=a.a.observable(),this.length_display=a.a.observable(),c.a.extend(l.a),c.a.extend(b.a),c.a.extend(p.a),this.date.subscribe((function(e){var r=c()(e);t.date_display(r.format("llll")),t.date_display_since(r.fromNow())})),this.length.subscribe((function(e){t.length_display(c.a.duration(e,"seconds").humanize())})),this.config=a.a.observable(),this.builder=a.a.observable(r.builder),this.commands=a.a.observableArray(r.commands),this.commit=a.a.observable(r.commit),this.commit_short=a.a.computed((function(){var e=t.commit();if(e)return e.substring(0,8)})),this.docs_url=a.a.observable(r.docs_url),this.commit_url=a.a.observable(r.commit_url),this.legacy_output=a.a.observable(!1),this.selected_hash=a.a.observable(o()(location).attr("hash")),this.selected_hash.subscribe((function(e){o()(location).attr("hash",e)})),this.selected_line=a.a.observable(),this.selected_line.subscribe((function(e){e&&e.is_selected(!1)}),this,"beforeChange"),this.selected_line.subscribe((function(e){e.command.is_expanded(!0),e.is_selected(!0),t.selected_hash(e.anchor_id())})),this.show_debug=a.a.observable(!1),this.is_polling=a.a.observable(!0),this.is_polling.subscribe((function(e){e||t.set_selected_line_from_hash(t.selected_hash())})),this.poll_api()}return w(e,[{key:"poll_api",value:function(){var e=this;o.a.getJSON(this.api_url+this.id+"/").then((function(t){e.date(t.date),e.success(t.success),e.error(t.error),e.length(t.length),e.commit(t.commit),e.docs_url(t.docs_url),e.commit_url(t.commit_url),e.builder(t.builder),e.config(t.config),e.state(t.state),e.state_display(t.state_display),e.add_command({id:0,command:"readthedocs-build --show-config",output:JSON.stringify(t.config,null," "),exit_code:0,run_time:0,is_debug:!0});var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=y(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;e.add_command(o)}}catch(e){n.e(e)}finally{n.f()}e.is_loading(!1)})),this.finished()?this.is_polling(!1):setTimeout((function(){e.poll_api()}),2e3)}},{key:"add_command",value:function(e){a.a.utils.arrayFirst(this.commands(),(function(t){return t.id()===e.id}))||this.commands.push(new T(e))}},{key:"set_selected_line",value:function(e){this.selected_line(e);var t=document.querySelector("[data-selected=true]");return t&&(t.scrollIntoView?t.scrollIntoView({behavior:"auto",block:"center",inline:"center"}):o()(t).focus()),!1}},{key:"set_selected_line_from_hash",value:function(e){if(e){var t=e.match(/^#(\d+)--(\d+)$/);if(!t)return;var r=a.a.utils.arrayFirst(this.commands(),(function(e){return e.id()==t[1]}));if(r){var n=a.a.utils.arrayFirst(r.output_lines(),(function(e){return e.line_number()==t[2]}));n&&this.set_selected_line(n)}}}},{key:"show_legacy_output",value:function(){this.legacy_output(!0)}},{key:"toggle_debug",value:function(){var e=this.show_debug();this.show_debug(!e)}}]),e}();O=E,x="BuildDetailView",(P=S(P="view_name"))in O?Object.defineProperty(O,P,{value:x,enumerable:!0,configurable:!0,writable:!0}):O[P]=x,v.a.add_view(E);r(3);function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r=h[o];t.device[o](i)}}));var r=a()(window),n=function(){t.viewport_width(r.width())};r.on("resize",n),n()})),y=function(){function e(t){b(this,e),this.id=t.id,this.url=t.url,this.loaded=o.a.observable(!1),this.loading=o.a.observable(!1),this.promise=null,this.data=o.a.observable()}return l(e,[{key:"fetch",value:function(){var e=this;if(this.promise)return this.promise;this.promise=new Promise((function(t,r){if(e.loaded())return t(e.data());e.loading(!0),a.a.getJSON(e.url).then((function(r){return e.data(r),e.loaded(!0),e.loading(!1),t(r)}))}))}}]),e}(),_=l((function e(){var t=this;b(this,e),this.config=o.a.observable(),this.search_project_config=o.a.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=new URL(e.api_projects_list_url,window.location.origin);r.search="?name={query}",t.search_project_config({type:"category",apiSettings:{url:r.href,onResponse:function(e){return{results:{"category-projects":{name:"Projects",results:e.results.map((function(e,t){var r=e.slug;e.subproject_of?r="Subproject of "+e.subproject_of.name:e.translation_of&&(r=e.language.name+" translation of "+e.translation_of.name);var n=new URL(e.urls.home),o=new URL(window.location.href);return n.hostname!=o.hostname&&(n.hostname=o.hostname),{title:e.name,description:r,url:n.toString()}}))}}}}},minCharacters:2})}}))}));d=_,v="HeaderView",(p=f(p="view_name"))in d?Object.defineProperty(d,p,{value:v,enumerable:!0,configurable:!0,writable:!0}):d[p]=v,u.a.add_view(_)},,function(e,t,r){"use strict";r(1)},function(e,t,r){"use strict";(function(e,n){r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return b}));var o=r(1),i=r.n(o),a=r(0),u=r.n(a);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?i-1:0),u=1;u select").dropdown({placeholder:""}),o()("[data-content]:not([data-semanticui-popup])").popup({position:"top center",delay:{show:500},variation:"small"}),o()(".ui.menu > .item[data-tab]").tab(),new a.a("[data-clipboard-text], [data-clipboard-target]"),o()("[data-clipboard-text], [data-clipboard-target]").popup({on:"click",hoverable:!1,content:"Copied!"})}}])&&f(n.prototype,i),l&&f(n,l),Object.defineProperty(n,"prototype",{writable:!1}),t}()}).call(this,r(7))},,function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r.n(n),i=r(1),a=r.n(i);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"body";console.debug("Attaching application to selector:",e),o.a.applyBindings(this,a()(e)[0])}},{key:"show_modal",value:function(e){return function(t,r){var n="[data-modal-id="+e+"]";console.debug("Showing modal:",n),0===a()(n).modal("show").length&&console.debug("Modal not found:",n)}}},{key:"post_child_form",value:function(e,t){var r=t.currentTarget.querySelector(":scope > form");return r&&r.submit(),!1}}])&&c(t.prototype,r),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},,,,function(e,t,r){r(15),e.exports=r(16)},function(e,t,r){},function(e,t,r){"use strict";r.r(t);var n=r(1),o=r.n(n),i=r(8);o()(document).ready((function(){(new i.a).run()}))},,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";var n=r(1),o=r.n(n),i=r(0),a=r.n(i),u=r(2);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0)setTimeout(n,2e3);else{var o=e.statusText;e.responseJSON&&(o=e.responseJSON.detail),t.reject({message:o})}}))}),2e3),t})(e).then((function(){t.resolve()})).fail((function(e){t.reject(e)}))},error:function(e){var r=e.responseJSON.detail||e.statusText;t.reject({message:r})}}),t}h(w,"view_name","ProjectTrafficAnalyticsView"),u.a.add_view(w);r(5);var j=r(3);function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function P(e,t){return(P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=T(e);if(t){var o=T(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return k(this,r)}}function k(e,t){if(t&&("object"===O(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function E(e,t){for(var r=0;r0}))})),B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}(r,e);var t=x(r);function r(){var e;return R(this,r),(e=t.call(this)).config=o.a.observable(),e.search_config=o.a.observable(),e.selected=o.a.observable(),e.is_loading=o.a.observable(!1),e.is_syncing=o.a.observable(!1),e.is_selected=o.a.computed((function(){return void 0!==e.selected()})),e.error=o.a.observable(),e.config.subscribe((function(t){void 0!==t&&e.init_search()})),e}return A(r,[{key:"sync_remote_repos",value:function(){var e=this,t=this.config(),r={url:t.urls.api_sync_remote_repositories,token:t.csrf_token};return this.is_syncing(!0),this.is_loading(!0),S(r).fail((function(t){console.error("Error syncing remote repositories:",t.message),e.error(t.message)})).always((function(){e.is_syncing(!1),e.is_loading(!1)}))}},{key:"init_search",value:function(){var e=this,t=this.config().urls.remoterepository_list+"?full_name={query}";this.search_config({type:"knockout",templates:{knockout:function(e){var t=a()("
");o.a.applyBindingsToNode(t[0],{template:{name:"remote-repo-results",data:{remote_repos:e.results.map((function(e){return new D(e)}))}}});var r=t.html();return t.remove(),r}},apiSettings:{url:t},selector:{prompt:".ui.text",title:".title .text"},fullTextSearch:!0,onSelect:function(t,r){e.selected(new D(t))}})}}]),r}(j.b);function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&L(e,t)}function L(e,t){return(L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function $(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=M(e);if(t){var o=M(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return J(this,r)}}function J(e,t){if(t&&("object"===H(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var r=0;r0&&void 0!==arguments[0]&&arguments[0];U(this,e),this.is_expanded=o.a.observable(r),this.dropdown_class=o.a.computed((function(){return t.is_expanded()?"fa-caret-down":"fa-ellipsis"}))}return F(e,[{key:"toggle_expanded",value:function(){var e=this.is_expanded();this.is_expanded(!e)}}]),e}();W(G,"view_name","ProjectHeaderView"),u.a.add_view(G);var K=function(){function e(){var t=this;U(this,e),this.projects=o.a.observableArray(),this.config=o.a.observable(),this.filter_project_config=o.a.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=e.api_url+"?name={query}";e.errors;t.filter_project_config({apiSettings:{url:r,cache:!1},throttle:500,fields:{name:"name",value:"slug"},saveRemoteData:!1,filterRemoteData:!1,sortSelect:!0,onChange:function(e,t,r){window.location.href="?project="+e}})}})),this.filter_config={action:"select",onChange:function(e,t,r){r.closest("form").submit()}}}return F(e,[{key:"project",value:function(e){var t=new X(e);return this.projects.push(t),t}}]),e}();W(K,"view_name","ProjectListView"),u.a.add_view(K);var X=function(e){q(r,e);var t=$(r);function r(e){var n;return U(this,r),(n=t.call(this,e)).url_docs=o.a.observable(),n.data.subscribe((function(e){n.url_docs(e.canonical_url)})),n}return F(r)}(j.a),Y=function(){function e(){var t=this;U(this,e),this.config=o.a.observable(),this.is_loading=o.a.observable(!1),this.search_config=o.a.computed((function(){var e=t.config();if(void 0!==e)return t.init_search(e)}))}return F(e,[{key:"init_search",value:function(e){return{apiSettings:{url:e.api_url+"?verbose_name={query}"},selector:{prompt:".ui.text"},fields:{title:"verbose_name",description:"identifier"},fullTextSearch:!0,onSelect:function(e,t){window.location.href=e.urls.dashboard.edit},error:e.errors||{}}}}]),e}();W(Y,"view_name","ProjectVersionCreateView"),u.a.add_view(Y);var Z=function(){function e(){var t=this;U(this,e),this.versions=o.a.observableArray(),this.config=o.a.observable(),this.filter_version_config=o.a.observable(),this.config.subscribe((function(e){if(void 0!==e){var r=e.api_url+"?verbose_name={query}&active=True";e.errors;t.filter_version_config({apiSettings:{url:r,cache:!1,onResponse:function(e){return{results:e.results.map((function(e){return console.dir(e),{name:e.verbose_name,value:e.slug}}))}}},throttle:500,saveRemoteData:!1,filterRemoteData:!1,sortSelect:!0,onChange:function(e,t,r){window.location.href="?version="+e}})}})),this.filter_config={action:"select",onChange:function(e,t,r){r.closest("form").submit()}}}return F(e,[{key:"attach_add_version",value:function(){return console.debug(arguments),{}}},{key:"version",value:function(e){var t=new ee(e);return this.versions.push(t),t}}]),e}();W(Z,"view_name","ProjectVersionListView"),u.a.add_view(Z);var ee=function(e){q(r,e);var t=$(r);function r(e){var n;return U(this,r),(n=t.call(this,e)).url_pdf=o.a.observable(),n.url_epub=o.a.observable(),n.url_html=o.a.observable(),n.url_docs=o.a.observable(),n.is_built=o.a.observable(!0),n.data.subscribe((function(e){n.url_pdf(e.downloads.pdf),n.url_epub(e.downloads.epub),n.url_html(e.downloads.html),n.url_docs(e.urls.documentation),n.is_built(e.built)})),n}return F(r,[{key:"trigger_build",value:function(e,t){return function(r,n){a.a.ajax({type:"POST",url:e,data:{csrfmiddlewaretoken:t}}).then((function(e){e.build.urls.build?window.location.href=e.build.urls.build:console.debug("Redirect to new build failed")})).catch((function(e){console.error(e)}))}}}]),r}(j.a)},function(e,t,r){"use strict";var n=r(1),o=r.n(n),i=r(0),a=r.n(i),u=r(4),c=r.n(u),s=r(11),l=r.n(s),f=r(12),b=r.n(f),d=r(13),p=r.n(d),v=r(2);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return _(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&r.is_expanded(!0)})),this.output=a.a.observable(),this.output_lines=a.a.computed((function(){return r.output().split(/\n/).map((function(e,t){return new k({command:r,output:e,line_number:t+1})}))}),null,{deferEvaluation:!0}),this.output(t.output)}return w(e,[{key:"color_output",value:function(e){return Promise.all([r.e(0).then(r.t.bind(null,45,7)).then((function(e){return e.default})),r.e(4).then(r.t.bind(null,46,7)).then((function(e){return e.default}))]).then((function(t){var r,n,o=m(t,2);r=o[0],n=o[1];var i=new r;return i.use_classes=!0,e=n(e=i.ansi_to_html(e),{allowedTags:["span"],allowedAttributes:{span:["class"]}})}))}},{key:"toggle_expanded",value:function(){return this.is_expanded(!this.is_expanded()),!1}}]),e}(),E=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};j(this,e),this.id=r.id,this.api_url="/api/v2/build/",this.success=a.a.observable(r.success),this.error=a.a.observable(r.error),this.state=a.a.observable(r.state),this.state_display=a.a.observable(r.state_display),this.finished=a.a.computed((function(){return["finished","cancelled"].includes(t.state())})),this.is_loading=a.a.observable(!0),this.progress_config=a.a.computed((function(){var e=t.state(),r=["triggered","queued","cloning","installing","building","uploading","finished"];if(a.a.computedContext.isInitial())return{autoSuccess:!1,value:r.indexOf(e),total:r.length-1,label:t.state_display()};if(t.finished()){var n="cancelled"===e,o=t.error()||!1===t.success();return n?function(e){e("set warning","Build cancelled")}:o?function(e){e("set error","Build failed")}:function(e){e("set success","Build succeeded")}}return function(n){n("set progress",r.indexOf(e)),n("set label",t.state_display())}})).extend({deferred:!0}),this.date=a.a.observable(r.date),this.length=a.a.observable(r.length),this.date_display=a.a.observable(),this.date_display_since=a.a.observable(),this.length_display=a.a.observable(),c.a.extend(l.a),c.a.extend(b.a),c.a.extend(p.a),this.date.subscribe((function(e){var r=c()(e);t.date_display(r.format("llll")),t.date_display_since(r.fromNow())})),this.length.subscribe((function(e){t.length_display(c.a.duration(e,"seconds").humanize())})),this.config=a.a.observable(),this.builder=a.a.observable(r.builder),this.commands=a.a.observableArray(r.commands),this.commit=a.a.observable(r.commit),this.commit_short=a.a.computed((function(){var e=t.commit();if(e)return e.substring(0,8)})),this.docs_url=a.a.observable(r.docs_url),this.commit_url=a.a.observable(r.commit_url),this.legacy_output=a.a.observable(!1),this.selected_hash=a.a.observable(o()(location).attr("hash")),this.selected_hash.subscribe((function(e){o()(location).attr("hash",e)})),this.selected_line=a.a.observable(),this.selected_line.subscribe((function(e){e&&e.is_selected(!1)}),this,"beforeChange"),this.selected_line.subscribe((function(e){e.command.is_expanded(!0),e.is_selected(!0),t.selected_hash(e.anchor_id())})),this.show_debug=a.a.observable(!1),this.is_polling=a.a.observable(!0),this.is_polling.subscribe((function(e){e||t.set_selected_line_from_hash(t.selected_hash())})),this.poll_api()}return w(e,[{key:"poll_api",value:function(){var e=this;o.a.getJSON(this.api_url+this.id+"/").then((function(t){e.date(t.date),e.success(t.success),e.error(t.error),e.length(t.length),e.commit(t.commit),e.docs_url(t.docs_url),e.commit_url(t.commit_url),e.builder(t.builder),e.config(t.config),e.state(t.state),e.state_display(t.state_display),e.add_command({id:0,command:"readthedocs-build --show-config",output:JSON.stringify(t.config,null," "),exit_code:0,run_time:0,is_debug:!0});var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=y(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;e.add_command(o)}}catch(e){n.e(e)}finally{n.f()}e.is_loading(!1)})),this.finished()?this.is_polling(!1):setTimeout((function(){e.poll_api()}),2e3)}},{key:"add_command",value:function(e){a.a.utils.arrayFirst(this.commands(),(function(t){return t.id()===e.id}))||this.commands.push(new T(e))}},{key:"set_selected_line",value:function(e){this.selected_line(e);var t=document.querySelector("[data-selected=true]");return t&&(t.scrollIntoView?t.scrollIntoView({behavior:"auto",block:"center",inline:"center"}):o()(t).focus()),!1}},{key:"set_selected_line_from_hash",value:function(e){if(e){var t=e.match(/^#(\d+)--(\d+)$/);if(!t)return;var r=a.a.utils.arrayFirst(this.commands(),(function(e){return e.id()==t[1]}));if(r){var n=a.a.utils.arrayFirst(r.output_lines(),(function(e){return e.line_number()==t[2]}));n&&this.set_selected_line(n)}}}},{key:"show_legacy_output",value:function(){this.legacy_output(!0)}},{key:"toggle_debug",value:function(){var e=this.show_debug();this.show_debug(!e)}}]),e}();O=E,x="BuildDetailView",(P=S(P="view_name"))in O?Object.defineProperty(O,P,{value:x,enumerable:!0,configurable:!0,writable:!0}):O[P]=x,v.a.add_view(E);r(3);function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t){for(var r=0;r - {% block project_add_content %} -
+
{% block project_add_content_header %}

@@ -22,57 +22,56 @@

{% endblock project_add_content_header %} - {% block project_add_content_main %} - {% endblock project_add_content_main %} + {% block project_add_content_form %} +
- + {% csrf_token %} + {{ wizard.management_form }} - {% csrf_token %} - {{ wizard.management_form }} - - {% block wizard_form %} - {% if wizard.form.forms %} - {{ wizard.form.management_form }} - {% for form in wizard.form.forms %} - {% csrf_token %} - {{ form|crispy }} - {% endfor %} - {% else %} - {{ wizard.form|crispy }} - {% endif %} - {% endblock wizard_form %} - - {% block wizard_actions %} -
- {% if wizard.steps.prev %} - {# TODO: the previous button should not validate the form #} - - {% endif %} - - {% if wizard.steps.next %} - + {% block wizard_form %} + {% if wizard.form.forms %} + {{ wizard.form.management_form }} + {% for form in wizard.form.forms %} + {% csrf_token %} + {{ form|crispy }} + {% endfor %} {% else %} - + {{ wizard.form|crispy }} {% endif %} -
- {% endblock wizard_actions %} + {% endblock wizard_form %} -
+ {% block wizard_actions %} +
+ {% if wizard.steps.prev %} + + {% endif %} + + {% if wizard.steps.next %} + + {% else %} + + {% endif %} +
+ {% endblock wizard_actions %} + + + {% endblock project_add_content_form %}
- {% endblock project_add_content %} - {% block project_add_help_topics %} -
-

{% trans "Help topics" %}

-
-
+
+ {% block project_add_sidebar %} +

{% trans "Help topics" %}

+
+ {% block project_add_sidebar_help_topics %} + {% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/intro/import-guide.html" text="Connecting a repository" is_external=True class="item" %} + {% include "includes/elements/link.html" with url="https://docs.readthedocs.io/en/stable/tutorial/index.html" text="Read the Docs tutorial" is_external=True class="item" %} + {% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/examples.html" text="Example projects" is_external=True class="item" %} + {% endblock project_add_sidebar_help_topics %} +
+ {% endblock project_add_sidebar %}
- {% endblock project_add_help_topics %} -
- - {% include "includes/utils/embed_docs.html" %} - -{% endblock %} + {% endblock project_add_content %} +{% endblock content %} diff --git a/readthedocsext/theme/templates/projects/import_config.html b/readthedocsext/theme/templates/projects/import_config.html index 655acdf8..3ee1e518 100644 --- a/readthedocsext/theme/templates/projects/import_config.html +++ b/readthedocsext/theme/templates/projects/import_config.html @@ -2,30 +2,60 @@ {% load i18n %} {% block project_add_content_subheader %} -{% trans "Add a configuration file (.readthedocs.yaml) to your project" %} + {% trans "Add a configuration file to your project" %} {% endblock project_add_content_subheader %} -{% block project_add_css_classes %}ui ten wide tablet wide computer column{% endblock project_add_css_classes %} -{% block project_add_content_main %} -

+{% block project_add_content_classes %}ui fourteen wide tablet twelve wide computer column{% endblock %} + +{% block project_add_content_form %} +

{% blocktrans trimmed %} - Make sure your project has a .readthedocs.yaml at the root of your repository. This file is required by Read the Docs to be able to build your documentation. You can read more about this in our documentation. + A .readthedocs.yaml configuration file is required at the root of your repository in order to build your documentation. {% endblocktrans %} -

+ + + {% trans "Learn how to add a configuration file to your project." %} + +
+ +
+ {% trans "Example configuration for:" %} + +
-
-        
-# .readthedocs.yaml
+  
+
+ .readthedocs.yaml +
+ + + + +
 # Read the Docs configuration file
 # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
 
 # Required
 version: 2
 
-# Set the OS, Python version and other tools you might need
+# Set the OS, Python version, and other tools you might need
 build:
   os: ubuntu-22.04
   tools:
@@ -50,12 +80,17 @@
 # python:
 #    install:
 #    - requirements: docs/requirements.txt
-        
-    
-

+
+ +
+ + {# Show the base form #} + {{ block.super }} -{{ block.super }} -{% endblock project_add_content_main %} +{% endblock project_add_content_form %} -{% block project_add_help_topics %} -{% endblock project_add_help_topics %} +{% block project_add_sidebar_help_topics %} + {% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/config-file/index.html" text="Configuration file tutorial" is_external=True class="item" %} + {% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/config-file/v2.html" text="Configuration file reference" is_external=True class="item" %} + {% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/guides/setup/git-repo-manual.html" text="Manually configuring a Git repository" is_external=True class="item" %} +{% endblock project_add_sidebar_help_topics %} diff --git a/src/js/application/index.js b/src/js/application/index.js index d5c401b3..75a297dd 100644 --- a/src/js/application/index.js +++ b/src/js/application/index.js @@ -130,10 +130,13 @@ export class Application { // Initialize clipboard, but only for data-clipboard-text. This is the most // generalized pattern for clipboard usage, so we won't yet worry about // adding the other data binding selectors. - var clipboard_global = new clipboard(".ui.button[data-clipboard-text]"); - jquery(".ui.button[data-clipboard-text]").popup({ + var clipboard_global = new clipboard( + "[data-clipboard-text], [data-clipboard-target]" + ); + jquery("[data-clipboard-text], [data-clipboard-target]").popup({ on: "click", hoverable: false, + content: "Copied!", }); } }