PluginProbe
codoc / 0.9.3.2
codoc v0.9.3.2
0.9.8.8 0.9.8.9 0.9.9 0.9.9.1 trunk 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.8.1 0.8.2 0.8.3 0.8.4 0.8.6 0.8.7 0.8.8 0.8.9 0.9 0.9.1 0.9.10 0.9.11 All 114 releases
← All changes | src/block/block.js +70 -19 0.8.90.9.3.2 View file →
@@ -84,9 +84,9 @@
84 84 }
85 85 setAttributes( { fetching: false } )
86 86 })
87 87 }
88 -
88 +
89 89 getShowPriceHelp( checked ) {
90 90 return checked ?
91 91 __( 'する' ) :
92 92 __( 'しない' );
@@ -95,9 +95,19 @@
95 95 return checked ?
96 96 __( '受け付ける' ) :
97 97 __( '受け付けない' );
98 98 }
99 -
99 + getShowPaywalledSupportHelp( checked ) {
100 + return checked ?
101 + __( '有料パートはアクセス時に非表示となりますが、「自由課金で読む」をタップ後に表示されます。閲覧者は内容に応じて金額を自由に指定して購入できます。購入されない場合もあるのでご注意ください。' ) :
102 + __( '' );
103 + }
104 + getStatusLimitedHelp( checked ) {
105 + return checked ?
106 + __( '限定公開:codoc側で一覧されません' ) :
107 + __( '通常公開' );
108 + }
109 +
100 110 render() {
101 111 const {
102 112 setAttributes,
103 113 attributes: {
@@ -104,14 +114,15 @@
104 114 showPrice,
105 115 price,
106 116 limited,
107 117 limitedCount,
108 -
118 +
109 119 affiliateMode,
110 120 affiliateRate,
111 121
112 122 showSupport,
113 -
123 + showPaywalledSupport,
124 + statusLimited,
114 125 subscriptions,
115 126 }
116 127 } = this.props;
117 128
@@ -116,16 +127,18 @@
116 127 } = this.props;
117 128
118 129 const toggleShowPrice = () => setAttributes( { showPrice: ! showPrice } );
119 130 const toggleLimited = () => setAttributes( { limited: ! limited } );
131 + const toggleShowPaywalledSupport = () => setAttributes( { showPaywalledSupport: ! showPaywalledSupport } );
132 + const toggleStatusLimited = () => setAttributes( { statusLimited: ! statusLimited } );
120 133 const toggleAffiliateMode = () => setAttributes( { affiliateMode: ! affiliateMode } );
121 134 const toggleShowSupport = () => setAttributes( { showSupport: ! showSupport } );
122 -
135 +
123 136 const SubscriptionCheckBoxes = withState({
124 137 checked_obj: Object.assign(new Object, subscriptions)
125 138 })( ( { checked_obj , setState } ) => (
126 139 <ul>
127 - {
140 + {
128 141 this.subscriptionsFetched.map((v) => (
129 142 <li><CheckboxControl
130 143 className="check_items"
131 144 label={v.label}
@@ -132,9 +145,9 @@
132 145 checked={checked_obj[v.value]}
133 146
134 147 onChange={ ( check ) => {
135 148 check ? checked_obj[v.value] = true : delete checked_obj[v.value]
136 - setAttributes({subscriptions : checked_obj})
149 + setAttributes({subscriptions : checked_obj})
137 150 setState({checked_obj})
138 151 } }
139 152 /></li>
140 153 ) )
@@ -165,13 +178,13 @@
165 178 help={ this.getShowPriceHelp }
166 179 ref="showPrice"
167 180 onChange={ toggleShowPrice }
168 181 />
169 -
182 +
170 183 <div style={{ display: showPrice ? 'initial' : 'none' }}>
171 184
172 185 <RangeControl
173 - label={ __( '価格(円)' ) }
186 + label={ __( '価格(円)') + __(showPaywalledSupport ? '【希望額として表示】' : '' ) }
174 187 value={ price }
175 188 initialPosition={ price }
176 189 onChange={ ( value ) => {
177 190 // do validate this
@@ -179,10 +192,18 @@
179 192 }}
180 193 min="100"
181 194 max="50000"
182 195 /><br />
183 -
196 +
184 197 <ToggleControl
198 + label={ __( '自由課金' ) }
199 + checked={ !! showPaywalledSupport }
200 + help={ this.getShowPaywalledSupportHelp }
201 + onChange={ toggleShowPaywalledSupport }
202 + />
203 +
204 + <div style={{ display: showPaywalledSupport ? 'none' : 'initial' }}>
205 + <ToggleControl
185 206 label={ __( '数量限定販売' ) }
186 207 checked={ !! limited }
187 208 onChange={ toggleLimited }
188 209 />
@@ -199,9 +220,9 @@
199 220 min="1"
200 221 max="100"
201 222 /><br />
202 223 </div>
203 -
224 +
204 225 <ToggleControl
205 226 label={ __( 'アフィリエイト' ) }
206 227 checked={ !! affiliateMode }
207 228 onChange={ toggleAffiliateMode }
@@ -214,13 +235,15 @@
214 235 options={ affiliateRateOptions }
215 236 value={ affiliateRate }
216 237 onChange={ ( value ) => {
217 238 setAttributes( { affiliateRate: value } );
218 - }}/><br />
239 + }}/><br />
219 240 </div>
220 -
241 +
221 242 </div>
222 -
243 + </div>
244 +
245 + <div style={{ display: showPaywalledSupport ? 'none' : 'initial' }}>
223 246 <ToggleControl
224 247 label={ __( 'サポート' ) }
225 248 checked={ !! showSupport }
226 249 value="1"
@@ -226,12 +249,30 @@
226 249 value="1"
227 250 onChange={ toggleShowSupport }
228 251 help={ this.getShowSupportHelp }
229 252 />
253 + </div>
254 +
255 + <div style={{ display: 'initial' }}>
256 + <ToggleControl
257 + label={ __( '限定公開' ) }
258 + checked={ !! statusLimited }
259 + value="1"
260 + onChange={ toggleStatusLimited }
261 + help={ this.getStatusLimitedHelp }
262 + />
263 + </div>
264 +
265 + <div class="codoc-subscription-title">
266 + <label>サブスクリプション</label>
267 + <a
268 + href={ CODOC_URL + '/me/subscriptions'}
269 + target="_blank" class="codoc-subscription-add">追加</a>
270 + </div>
230 271
231 - <label>サブスクリプション</label>
232 272 <SubscriptionCheckBoxes />
233 273
274 +
234 275 </PanelBody>
235 276 </InspectorControls>
236 277 );
237 278 }
@@ -248,8 +289,10 @@
248 289 this.props.setAttributes({ limitedCount: this.props.attributes.limitedCount == null ? 10 : this.props.attributes.limitedCount });
249 290 this.props.setAttributes({ affiliateMode: this.props.attributes.affiliateMode == null ? false : this.props.attributes.affiliateMode });
250 291 this.props.setAttributes({ affiliateRate: this.props.attributes.affiliateRate == null ? '0.0500' : this.props.attributes.affiliateRate });
251 292 this.props.setAttributes({ showSupport: this.props.attributes.showSupport == null ? false : this.props.attributes.showSupport });
293 + this.props.setAttributes({ showPaywalledSupport: this.props.attributes.showPaywalledSupport == null ? false : this.props.attributes.showPaywalledSupport });
294 + this.props.setAttributes({ statusLimited: this.props.attributes.statusLimited == null ? false : this.props.attributes.statusLimited });
252 295 this.props.setAttributes({ subscriptions: this.props.attributes.subscriptions == null ? {} : this.props.attributes.subscriptions });
253 296
254 297 this.onChangeInput = this.onChangeInput.bind( this );
255 298 this.onKeyDown = this.onKeyDown.bind( this );
@@ -271,9 +314,9 @@
271 314 if ( keyCode === ENTER ) {
272 315 insertBlocksAfter( [ createBlock( getDefaultBlockName() ) ] );
273 316 }
274 317 }
275 -
318 +
276 319 render() {
277 320 const {
278 321 attributes: {
279 322 customText,
@@ -306,9 +349,9 @@
306 349
307 350
308 351 registerBlockType( 'codoc/codoc-block', {
309 352 title: __( 'codoc' ),
310 - description: __( 'このブロックから下のブロックは認証されたcodocユーザーのみが閲覧できる有料エリアとなります。' ),
353 + description: __( 'このブロックから下のブロックは認証されたcodocユーザーのみが閲覧できる有料エリアとなります。' ),
311 354 icon,
312 355 category: 'layout',
313 356 supports: {
314 357 customClassName: false,
@@ -349,8 +392,16 @@
349 392 showSupport: {
350 393 type: 'boolean',
351 394 default: null,
352 395 },
396 + showPaywalledSupport: {
397 + type: 'boolean',
398 + default: null,
399 + },
400 + statusLimited: {
401 + type: 'boolean',
402 + default: null,
403 + },
353 404 subscriptions: {
354 405 type: 'object',
355 406 default: null,
356 407 },
@@ -362,11 +413,11 @@
362 413 type: 'string',
363 414 default: null,
364 415 },
365 416 },
366 -
417 +
367 418 edit: EditBlockContent,
368 -
419 +
369 420 save: function( props ) {
370 421 const {
371 422 setAttributes,
372 423 attributes: {