diff --git a/stdlib/themes/bootstrap/core/core.opa b/stdlib/themes/bootstrap/core/core.opa index ad82459c..53387e26 100644 --- a/stdlib/themes/bootstrap/core/core.opa +++ b/stdlib/themes/bootstrap/core/core.opa @@ -584,8 +584,7 @@ _ = Client_code.register_css_declaration([icon16,icon32]) Bootstrap = {{ - version = ServerReference.create("2.0.1") : reference(string) - + @private compute_version_url(v:string) = if String.le(v, "1.2.0") then "https://raw.github.com/twitter/bootstrap/v{v}/bootstrap-{v}.min.css" @@ -594,16 +593,36 @@ Bootstrap = {{ else "http://twitter.github.com/bootstrap/assets/css/bootstrap.css" - @deprecated - unimport() = - Resource.unregister_external_css(compute_version_url(Reference.get(version))) + @private + option : DynamicResource.config = { + sufix=some("bootstrap.min.css") + prefix=none + onaccess=none + } + + @private + param = { + expiration={none} + consumption={unlimited} + visibility={shared} + } + + @private + publish_css(name) = DynamicResource.publish_extend(name, param, option) + + @private + files_css = @static_include_directory("stdlib/themes/bootstrap/css") + + @private + uri_css = Map.map(publish_css, files_css) + + url(v:string) = + Map.get("stdlib/themes/bootstrap/css/{v}/bootstrap.min.css", uri_css) ? + compute_version_url(v) - @deprecated import(v:string) = - // unregister the previous registered version - do unimport() - // set and register the new version to import - do Reference.set(version, v) - Resource.register_external_css(compute_version_url(v)) + Resource.register_external_css( + url(v) + ) }} diff --git a/stdlib/themes/bootstrap/style.opa b/stdlib/themes/bootstrap/latest.opa similarity index 60% rename from stdlib/themes/bootstrap/style.opa rename to stdlib/themes/bootstrap/latest.opa index d1ce252d..03894916 100644 --- a/stdlib/themes/bootstrap/style.opa +++ b/stdlib/themes/bootstrap/latest.opa @@ -24,9 +24,9 @@ * It also includes several sets of icons. * * {2 Where should I start} - * If you want to use the current version (1.3.0), just import this package. - * Otherwise, import stdlib.themes.bootstrap.core and call: Bootstrap.import(VERSION) - * before launching your server (note: no check is performed), or import stdlib.themes.bootstrap-VERSION. + * If you want to use the latest version, just import this package (stdlib.themes.bootstrap). + * Otherwise, import stdlib.themes.bootstrap.v{X_Y_Z}. + * /!\ If the version you are looking for is not embed in Opa, it will reference GitHub's URL. * * {3 How to use icons} * There are different sizes: @@ -44,36 +44,4 @@ import stdlib.themes.bootstrap.core -@private -option : DynamicResource.config = { - sufix=some("bootstrap.min.css") - prefix=none - onaccess=none -} - -@private -param = { - expiration={none} - consumption={unlimited} - visibility={shared} -} - -@private -publish_css(name) = DynamicResource.publish_extend(name, param, option) - -/* resources */ -@private -files_css = @static_include_directory("stdlib/themes/bootstrap/css") - -@private -uri_css = Map.map(publish_css, files_css) - -@private -current_bootstrap_url = - Bootstrap.compute_version_url(Reference.get(Bootstrap.version)) - -@private -url(name) = - Map.get("stdlib/themes/bootstrap/css/{name}", uri_css) ? current_bootstrap_url - -do Resource.register_external_css(url("{Reference.get(Bootstrap.version)}/bootstrap.min.css")) +do Bootstrap.import("2.0.1") diff --git a/stdlib/themes/bootstrap/v1_1_1/style.opa b/stdlib/themes/bootstrap/v1_1_1/style.opa index 8cc4f45f..2c43a535 100644 --- a/stdlib/themes/bootstrap/v1_1_1/style.opa +++ b/stdlib/themes/bootstrap/v1_1_1/style.opa @@ -1,5 +1,5 @@ /* - Copyright © 2011 MLstate + Copyright © 2011, 2012 MLstate This file is part of OPA. @@ -20,12 +20,11 @@ /** * {1 About this module} - * This module allows you to use version 1.1.1 of Twitter's bootstrap style + * This module allows you to use version 1.1.1 of Twitter's Bootstrap style * (http://twitter.github.com/bootstrap/) directly in your application. * It also includes several sets of icons. */ import stdlib.themes.bootstrap.core -this_bootstrap_version = "1.1.1" -do Bootstrap.import(this_bootstrap_version) +do Bootstrap.import("1.1.1") diff --git a/stdlib/themes/bootstrap/v1_3_0/style.opa b/stdlib/themes/bootstrap/v1_3_0/style.opa index 5447755a..a923a0f9 100644 --- a/stdlib/themes/bootstrap/v1_3_0/style.opa +++ b/stdlib/themes/bootstrap/v1_3_0/style.opa @@ -1,5 +1,5 @@ /* - Copyright © 2011 MLstate + Copyright © 2011, 2012 MLstate This file is part of OPA. @@ -20,12 +20,11 @@ /** * {1 About this module} - * This module allows you to use version 1.3.0 of Twitter's bootstrap style + * This module allows you to use version 1.3.0 of Twitter's Bootstrap style * (http://twitter.github.com/bootstrap/) directly in your application. * It also includes several sets of icons. */ import stdlib.themes.bootstrap.core -this_bootstrap_version = "1.3.0" -do Bootstrap.import(this_bootstrap_version) +do Bootstrap.import("1.3.0") diff --git a/stdlib/themes/bootstrap/v1_4_0/style.opa b/stdlib/themes/bootstrap/v1_4_0/style.opa new file mode 100644 index 00000000..f6e3732b --- /dev/null +++ b/stdlib/themes/bootstrap/v1_4_0/style.opa @@ -0,0 +1,30 @@ +/* + Copyright © 2011, 2012 MLstate + + This file is part of OPA. + + OPA is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License, version 3, as published by + the Free Software Foundation. + + OPA is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + more details. + + You should have received a copy of the GNU Affero General Public License + along with OPA. If not, see . +*/ + +/*Author: Ida Swarczewskaja, MLstate */ + +/** + * {1 About this module} + * This module allows you to use version 1.4.0 of Twitter's Bootstrap style + * (http://twitter.github.com/bootstrap/) directly in your application. + * It also includes several sets of icons. + */ + +import stdlib.themes.bootstrap.core + +do Bootstrap.import("1.4.0")