Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[enhance] bootstrap: changed the import system, not using a reference…

… anymore, simplier
  • Loading branch information...
commit 670d50641848f6bc4b166451a666409b6efb31ad 1 parent 5f15484
@Aqua-Ye Aqua-Ye authored
View
41 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)
+ )
}}
View
40 stdlib/themes/bootstrap/style.opa → 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")
View
7 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")
View
7 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")
View
30 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 <http://www.gnu.org/licenses/>.
+*/
+
+/*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")
Please sign in to comment.
Something went wrong with that request. Please try again.