소스 검색

feat: added border helpers | feat: added artist endpoint | feat: added episode endpoint

tags/0.9.0
J 6 년 전
부모
커밋
b1f845d750

+ 6
- 2
plugins/cia-endpoints/cia-end-points.php 파일 보기

@@ -38,6 +38,10 @@ add_action( 'rest_api_init', function () {
38 38
  * Craft in America custom post_types
39 39
  */
40 40
 add_action( 'rest_api_init', function () {
41
-    $media_controller = new Make_Endpoint_For('customtype');
42
-    $media_controller->register_custom_route('custometypes');
41
+    $media_controller = new Make_Endpoint_For('episode');
42
+    $media_controller->register_custom_route('episodes');
43 43
 });
44
+add_action( 'rest_api_init', function () {
45
+    $media_controller = new Make_Endpoint_For('artist');
46
+    $media_controller->register_custom_route('artists');
47
+});

+ 3
- 3
plugins/includes/custom-types.php 파일 보기

@@ -1,9 +1,9 @@
1 1
 <?php
2 2
     function get_all_custom_types() {
3 3
         return array(
4
-            'customtype',
5
-            // 'artist',
6
-            // 'episode',
4
+            // 'customtype',
5
+            'artist',
6
+            'episode',
7 7
             // 'short',
8 8
             // 'talk',
9 9
             // 'object',

+ 5
- 0
vue-theme/functions.php 파일 보기

@@ -154,6 +154,11 @@ remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
154 154
 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
155 155
 remove_action( 'wp_print_styles', 'print_emoji_styles' );
156 156
 remove_action( 'admin_print_styles', 'print_emoji_styles' );
157
+// REMOVE block CSS
158
+function webapptiv_remove_block_library_css() {
159
+    wp_dequeue_style( 'wp-block-library' );
160
+}
161
+add_action( 'wp_enqueue_scripts', 'webapptiv_remove_block_library_css' );
157 162
 
158 163
 // header( 'Access-Control-Allow-Origin: http://localhost:8080' );
159 164
 header( 'Content-Type: application/json' );

+ 7
- 0
vue-theme/src/app.vue 파일 보기

@@ -46,6 +46,11 @@ html > body
46 46
             padding: $ms
47 47
             align-items: flex-start
48 48
             
49
+            .shadow
50
+                box-shadow: rgb(34, 36, 37) 0px 0px 4px 0px
51
+            .b-radius
52
+                border-radius:5px
53
+                
49 54
             /* Content Pieces */
50 55
             .post
51 56
                 background-color: teal
@@ -59,6 +64,8 @@ html > body
59 64
                         color: white
60 65
                     .wp-block-image
61 66
                         margin: 0
67
+                        img
68
+                            width: 100%
62 69
                 > ul
63 70
                     list-style: none
64 71
             

+ 2
- 2
vue-theme/src/pages/index.vue 파일 보기

@@ -1,7 +1,7 @@
1 1
 // Homepage grid
2 2
 <template lang="pug">
3 3
 .page--index.f-row.between
4
-    article.f-grow
4
+    article.f-grow.shadow.b-radius
5 5
         header
6 6
             h1 {{ site }}: index
7 7
         section(v-if="allPagesLoaded")
@@ -20,7 +20,7 @@
20 20
             p icon
21 21
 
22 22
     //- COMPONENT: Make this with a prop
23
-    aside
23
+    aside.shadow.b-radius
24 24
         header
25 25
             h4 this is some other stuff
26 26
         section(v-if="allPostsLoaded")

+ 9
- 1
vue-theme/src/sss/_helpers.sss 파일 보기

@@ -24,4 +24,12 @@
24 24
     &-col
25 25
         flex-direction: column
26 26
     &-grow
27
-        flex-grow: 1
27
+        flex-grow: 1
28
+
29
+.b
30
+    &-radius
31
+        border-radius: 5px
32
+    &-none
33
+        border: none
34
+    &-solid
35
+        border: #000000 1px solid

+ 46
- 0
vue-theme/src/store/modules/artist.js 파일 보기

@@ -0,0 +1,46 @@
1
+import api from '../../utils/api'
2
+
3
+const state = {
4
+    all: {},
5
+    loaded: false,
6
+    artist: null,
7
+}
8
+
9
+const getters = {
10
+    allArtists: state => state.all,
11
+    allArtistsLoaded: state => state.loaded,
12
+    artist: state => id => {
13
+        let field = typeof id === 'number' ? 'id' : 'slug'
14
+        let artist = state.all.filter(artist => artist[field] === id)
15
+        return (artist[0]) ? artist[0] : false
16
+    },
17
+    artistContent: state => id => {
18
+        let field = typeof id === 'number' ? 'id' : 'slug'
19
+        let artist = state.all.filter(artist => artist[field] === id)
20
+
21
+        return (artist[0]) ? artist[0].content.rendered : false
22
+    },
23
+    someArtists: state => limit => {
24
+        if (state.all.length < 1) return false
25
+
26
+        let all = [...state.all]
27
+
28
+        return all.splice(0, Math.min(limit, state.all.length))
29
+    },
30
+}
31
+
32
+const actions = {
33
+    getAllArtists({ commit }) {
34
+        api.getByType('artists', artists => {
35
+            commit('STORE_FETCHED_ARTISTS', { artists })
36
+            commit('ARTISTS_LOADED', true)
37
+        })
38
+    }
39
+}
40
+
41
+const mutations = {
42
+    STORE_FETCHED_ARTISTS(state, { artists }) { state.all = artists },
43
+    ARTISTS_LOADED(state, val) { state.loaded = val },
44
+}
45
+
46
+export default { state, getters, actions, mutations }

+ 46
- 0
vue-theme/src/store/modules/episode.js 파일 보기

@@ -0,0 +1,46 @@
1
+import api from '../../utils/api'
2
+
3
+const state = {
4
+    all: {},
5
+    loaded: false,
6
+    episode: null,
7
+}
8
+
9
+const getters = {
10
+    allEpisodes: state => state.all,
11
+    allEpisodesLoaded: state => state.loaded,
12
+    episode: state => id => {
13
+        let field = typeof id === 'number' ? 'id' : 'slug'
14
+        let episode = state.all.filter(episode => episode[field] === id)
15
+        return (episode[0]) ? episode[0] : false
16
+    },
17
+    episodeContent: state => id => {
18
+        let field = typeof id === 'number' ? 'id' : 'slug'
19
+        let episode = state.all.filter(episode => episode[field] === id)
20
+
21
+        return (episode[0]) ? episode[0].content.rendered : false
22
+    },
23
+    someEpisodes: state => limit => {
24
+        if (state.all.length < 1) return false
25
+
26
+        let all = [...state.all]
27
+
28
+        return all.splice(0, Math.min(limit, state.all.length))
29
+    },
30
+}
31
+
32
+const actions = {
33
+    getAllEpisodes({ commit }) {
34
+        api.getByType('episodes', episodes => {
35
+            commit('STORE_FETCHED_EPISODES', { episodes })
36
+            commit('EPISODES_LOADED', true)
37
+        })
38
+    }
39
+}
40
+
41
+const mutations = {
42
+    STORE_FETCHED_EPISODES(state, { episodes }) { state.all = episodes },
43
+    EPISODES_LOADED(state, val) { state.loaded = val },
44
+}
45
+
46
+export default { state, getters, actions, mutations }

Loading…
취소
저장