# Locations 插件 🌍

**URL:** https://meta.discourse.org/t/locations-plugin/69742
**Category:** Plugin
**Tags:** paid-support
**Created:** [2017年九月10日 10:36 UTC](https://meta.discourse.org/t/locations-plugin/69742 "2017-09-10T10:36:41Z")
**Posts on this page:** 20
**Page:** 15

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年八月27日 08:28 UTC](https://meta.discourse.org/t/locations-plugin/69742/773 "2022-08-27T08:28:56Z")

</div>

@Canapin 一旦成熟，我非常欢迎将其作为 PR 合并到主插件存储库，前提是：

- 该行为由插件设置控制
- CSS 的设计方式不会干扰其他对该出口（outlet）的用法，只要它还有其他用途。

例如，[Topic Ratings](https://meta.discourse.org/t/topic-ratings-plugin/39578) 也使用了相同的插件出口。事实证明，您可以通过同一个出口链接事物。我测试过，似乎如果两者同时激活，它们都会显示（好 👍 ），但您不希望 CSS 不必要地干扰评分部分。

- 如果设置关闭，也是如此
- 另外，如果设置关闭，您希望图标保留在原始位置。

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2022年十月15日 23:11 UTC](https://meta.discourse.org/t/locations-plugin/69742/774 "2022-10-15T23:11:48Z")

</div>

你好！

关于如何添加或删除与站点设置相关的 CSS 规则，有什么快速提示吗？我不知道该怎么做。🙈

* * *

我还补充说，文档链接中的图片不再显示：

> [@angus](#):
>
> ### 文档链接
> 
> [管理设置](https://discourse.pluginmanager.org/t/administration-settings/298/2)  
> [主题中的位置](https://discourse.pluginmanager.org/t/locations-in-topics/297/2)  
> [类别中的位置](https://discourse.pluginmanager.org/t/locations-in-categories/296/2)

示例：

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/0/e/30ee7511a2243e8a2bdad7d46804960bfff7908b.png)

---

<div class="post-metadata">

### Author: ![vincefrommtl](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@vincefrommtl](https://meta.discourse.org/u/vincefrommtl)
#### Post date: [2022年十月27日 01:01 UTC](https://meta.discourse.org/t/locations-plugin/69742/775 "2022-10-27T01:01:37Z")

</div>

您好，

我刚刚更新了 Discourse（[1b56a55f50](https://github.com/discourse/discourse/commits/1b56a55f5087091a8573849a42c78f63992e1142)），我们的 Locations Plugin 无法正常工作。点击与该插件相关的按钮时，我得到了这个：

 ![Error](https://global.discourse-cdn.com/meta/original/4X/5/3/7/53777770bdf6d908ae3855b171e9fbf3dfbdd154.jpeg)

一切都是最新的，并且在更新之前它运行正常。请告诉我如何协助修复这个问题 🙂

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十月27日 09:20 UTC](https://meta.discourse.org/t/locations-plugin/69742/776 "2022-10-27T09:20:50Z")

</div>

感谢您的报告。

现已修复： [FIX: Show Map button failure by merefield · Pull Request #69 · merefield/discourse-locations · GitHub](https://github.com/paviliondev/discourse-locations/pull/69)

---

<div class="post-metadata">

### Author: ![vincefrommtl](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@vincefrommtl](https://meta.discourse.org/u/vincefrommtl)
#### Post date: [2022年十月27日 10:57 UTC](https://meta.discourse.org/t/locations-plugin/69742/777 "2022-10-27T10:57:47Z")

</div>

🙂 谢谢

这修复了地图！但其他按钮也坏了：创建讨论时点击“查找地址”，以及在主题列表中点击小位置图标时显示的是图钉按钮。

顺便说一句，感谢您提供的这个插件，它非常方便。

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十月27日 11:45 UTC](https://meta.discourse.org/t/locations-plugin/69742/778 "2022-10-27T11:45:22Z")

</div>

啊，抱歉，还有更多。我的快速文本搜索没有找到它们。

目前我还另外修复了：[FIX: Find Address button not functioning by merefield · Pull Request #70 · merefield/discourse-locations · GitHub](https://github.com/paviliondev/discourse-locations/pull/70)

你可能需要等一会儿才能处理另一个。

---

<div class="post-metadata">

### Author: ![Meathead40](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meathead40/32/256808_2.png) [@Meathead40](https://meta.discourse.org/u/Meathead40)
#### Post date: [2022年十月30日 05:04 UTC](https://meta.discourse.org/t/locations-plugin/69742/779 "2022-10-30T05:04:00Z")

</div>

大家好，我有兴趣在我的新用户注册过程中添加一个州/城市字段，然后用它来填充位置地图。有什么简单的方法可以实现这一点吗？谢谢！

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [2022年十一月19日 22:18 UTC](https://meta.discourse.org/t/locations-plugin/69742/780 "2022-11-19T22:18:49Z")

</div>

> [@Don](#):
>
> **我真的很喜欢这个功能！谢谢！** 🙂
> 
> 有一件事我不明白，也没有找到任何关于它的文档。`location_user_profile_format`。
> 
> 我使用 location iq，它生成的地址太长了（街道 + 城市 + 县 + 州 + 国家 + 邮政编码）。如果我使用地址格式，那么我可以限制这些参数。对吗？
> 
> 那么，如果我只想显示邮政编码 + 城市 + 街道，我可以用这个设置做到吗？
> 
> 我尝试使用（地址：数字）参数，但对我来说不起作用。我想我错过了什么 😕 它运行得很好，但地址中有太多不必要的信息。
> 
> 如果您有时间添加任何设置说明，我将不胜感激！😊 谢谢！

我遇到了完全相同的问题。有人能帮助 @Don 和我吗？🙂 谢谢！

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [2022年十一月20日 19:25 UTC](https://meta.discourse.org/t/locations-plugin/69742/781 "2022-11-20T19:25:50Z")

</div>

我还有另一个问题。当我尝试向新帖子添加位置并单击“保存”时，窗口不再关闭。在浏览器的开发者控制台中，我每次单击“保存”时都会看到以下内容：

`Deprecation notice: DButton no longer supports @action as a string. Please refactor to use an closure action instead. [deprecation id: discourse.d-button-action-string]`

是用户问题，还是其他插件或组件的问题，抑或只是一个错误？

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [2022年十一月21日 00:29 UTC](https://meta.discourse.org/t/locations-plugin/69742/782 "2022-11-21T00:29:30Z")

</div>

这一定是由于核心更改引起的，因为它也发生在 Events 插件上：

> [@Events Plugin calendar](https://meta.discourse.org/t/events-plugin/69776/768):
>
> also as of today i cant seem to add events? in console i get this: deprecated.js:61 Deprecation notice: DButton no longer supports @action as a string. Please refactor to use an closure action instead. [deprecation id: discourse.d-button-action-string] e.default @ deprecated.js:61 \_triggerAction @ d-button.js:99 click @ d-button.js:78 any ideas would be great!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十一月21日 08:59 UTC](https://meta.discourse.org/t/locations-plugin/69742/783 "2022-11-21T08:59:34Z")

</div>

此拉取请求正在进行中，完成后我会通知您。

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十一月21日 13:23 UTC](https://meta.discourse.org/t/locations-plugin/69742/784 "2022-11-21T13:23:19Z")

</div>

PR 已合并，如果您遇到任何问题，请告诉我

> <https://github.com/merefield/discourse-locations/pull/71>

@Roi

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [2022年十一月21日 22:28 UTC](https://meta.discourse.org/t/locations-plugin/69742/785 "2022-11-21T22:28:32Z")

</div>

> [@merefield](#):
>
> 此拉取请求正在进行中，完成后我会通知您。

谢谢，现在可以了 🙂

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十一月22日 10:06 UTC](https://meta.discourse.org/t/locations-plugin/69742/786 "2022-11-22T10:06:45Z")

</div>

我们已经合并了第二批修复和更新，请更新插件。

> <https://github.com/merefield/discourse-locations/pull/72>

---

<div class="post-metadata">

### Author: ![vincefrommtl](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@vincefrommtl](https://meta.discourse.org/u/vincefrommtl)
#### Post date: [2022年十一月22日 13:07 UTC](https://meta.discourse.org/t/locations-plugin/69742/787 "2022-11-22T13:07:50Z")

</div>

谢谢 🙂

虽然不严重，但我仍然看到这个错误：

 ![Screenshot 2022-11-22 080406](https://global.discourse-cdn.com/meta/original/4X/a/a/2/aa2732d685550880aa89eeba6650bcea34fae6c0.jpeg)

点击主题列表中的位置图标时，会显示固定图标，而不是跳转到主题的第一篇帖子。

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十一月22日 13:49 UTC](https://meta.discourse.org/t/locations-plugin/69742/788 "2022-11-22T13:49:54Z")

</div>

是的，这上面已经报告过了，我还没来得及看，抱歉。

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [2022年十二月10日 12:28 UTC](https://meta.discourse.org/t/locations-plugin/69742/789 "2022-12-10T12:28:29Z")

</div>

你好，

是否仍然可以在用户个人资料中显示 Discourse 核心字段“位置”？我之所以这样问，是因为在我使用的旧论坛系统中，用户可以在位置字段中输入类似“迈阿密”或“佛罗里达州”的内容，甚至可以输入精确的 GPS 坐标，以便在用户地图上显示。

使用 Discourse 位置插件，为用户地图输入的位置非常精确，而且看起来很难看，也很长。例如在德国，会显示为：`20, Benzstraße, Herrenberg (Stadt), Herrenberg, Vereinbarte Verwaltungsgemeinschaft der Stadt Herrenberg, Landkreis Böblingen, Baden-Württemberg, 71083, Deutschland`  
这也会破坏用户信息页面和用户卡片。

因此，最好是选择是否仍然在用户个人资料中显示 Discourse 核心字段以进行填写，并选择在用户信息页面和用户卡片上显示哪个字段。

谢谢，此致，  
Roi

附注：我完全忘记了，我已经在调整显示内容时遇到了这个问题：[Locations Plugin 🌍 - #780 by Roi](https://meta.discourse.org/t/locations-plugin/69742/780?u=roi)  
有人能帮忙吗？我无法在 `location user post format` 中输入有效的设置。对于我的论坛来说，一个完美的设置是只显示城市和国家，或者城市、州和国家。

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [2022年十二月10日 17:06 UTC](https://meta.discourse.org/t/locations-plugin/69742/790 "2022-12-10T17:06:39Z")

</div>

我还注意到，当在 `location user post format` 中输入“城镇”或“国家”或“城镇，国家”时（我在这里查看了字段的名称：[https://nominatim.openstreetmap.org/reverse?lat=48.7219128&lon=9.31618985），我在用户页面上看到用户在其个人资料中输入的网站出现了两次。所以我认为似乎存在一个错误……](https://nominatim.openstreetmap.org/reverse?lat=48.7219128&lon=9.31618985%EF%BC%89%EF%BC%8C%E6%88%91%E5%9C%A8%E7%94%A8%E6%88%B7%E9%A1%B5%E9%9D%A2%E4%B8%8A%E7%9C%8B%E5%88%B0%E7%94%A8%E6%88%B7%E5%9C%A8%E5%85%B6%E4%B8%AA%E4%BA%BA%E8%B5%84%E6%96%99%E4%B8%AD%E8%BE%93%E5%85%A5%E7%9A%84%E7%BD%91%E7%AB%99%E5%87%BA%E7%8E%B0%E4%BA%86%E4%B8%A4%E6%AC%A1%E3%80%82%E6%89%80%E4%BB%A5%E6%88%91%E8%AE%A4%E4%B8%BA%E4%BC%BC%E4%B9%8E%E5%AD%98%E5%9C%A8%E4%B8%80%E4%B8%AA%E9%94%99%E8%AF%AF%E2%80%A6%E2%80%A6)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十二月14日 11:39 UTC](https://meta.discourse.org/t/locations-plugin/69742/791 "2022-12-14T11:39:49Z")

</div>

我认为现有字段被 CSS 隐藏了。请尝试一下，看看是否能取消隐藏它。

欢迎为任何真正的改进提交拉取请求。

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2022年十二月14日 13:24 UTC](https://meta.discourse.org/t/locations-plugin/69742/792 "2022-12-14T13:24:56Z")

</div>

> [@Roi](#):
>
> 用户帖子格式的位置

这个例子对我来说很有效：

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/1/b/41b742fd70dff2973eb2145e3764a4a11fc5a3e0.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/a/2/fa2e1395c61ec8e0d3455e7525352be6552b7dae.png)

[上一頁](https://meta.discourse.org/t/locations-plugin/69742.md?page=14)

[下一頁](https://meta.discourse.org/t/locations-plugin/69742.md?page=16)
